July 2019

Workshop description

This one-day workshop will provide participants with the basic tools to program and use the RaspberryPi combined with the SenseHat. The workshop will provide a "Hands-On" approach to learning using a single-board computer with physical sensors. We will examine these sensors and learn to collect and manipulate data. The Workshop is aimed at learners of all age, who are interested in detecting and changes in the environment in which the computer is located, and feeding the data into the computer for processing and analysis. The learning style will include interactive workshopping using a computer laboratory as well as lectures. There will be many practical examples. The workshop will run from 08:30 am to 3:00 pm on 2nd, 3rd and 4th July 2019.

The aim of this workshop is to create a collaborative community of young future computational scientists in state-of-the-art numerical methods and computer technology, and their application to various scientific fields.

Program
  1. Workshop introduction. Presentation of the objective and the material

  2. Introduction to Python. Participants will be able to try basic Python codes in an online SenseHat simulator

  3. Using AstroPi resources.

  4. Worked example.

  5. Data analysis.

  6. Computer-based decision making and optimisation models [advanced]

Where to find the hardware

Electronic-Shop

Sample code

Clearing the Led
from sense_hat import SenseHat
from time import sleep

sense = SenseHat()


sense.clear()  # no arguments defaults to off
Collect data and save into a CSV file
from sense_hat import SenseHat
import time

sense = SenseHat()

file = open("Datafile.csv", "a")

file.write("time, temp \n")
print ("Time, temp")

for n in range(10):

    temp = sense.get_temperature()
    temp = round(temp, 2)

    file.write(time.strftime('%X'))
    file.write(",")
    file.write(str(temp))
    file.write("\n")

    print (time.strftime('%X'),temp)

    time.sleep(1)

file.close()