Month: June 2016

Heart Rate Monitor

Keep to the beat! – Heart Rate Monitor Tutorial

Last tutorial in our LED trilogy! If you haven’t – then check out our Light It Up!-LED Tutorial and CEED Universe Compass Tutorial.

Components needed: 

  1. ADS1115 x 1
  2. LDR x  1
  3. LED x 1
  4. 510 kΩ Resistor x 1
  5. 5 Ω  Resistor  x 1
  6. Wires x 11
  7. pi-topPROTO board x 1

Background: This project was created with hearts in mind. It demonstrates and reveals a technique to measure the heart rate by sensing the change in blood volume in a finger artery while your heart is pumping! Compared to our last two tutorials, it is a bit more complex; however, it is perfect for an inter-curricular class or a fun family project for the weekend.  


Step 1: In this tutorial you will learn to make a heart-rate-monitor with an LED circuit on the pi-topPROTO board.

Step 2: The diagram below illustrates how the components should be soldered onto the pi-topPROTO board:

heart_rate_monitor_schem

 

9

 

Step 3: To build this circuit on the pi-topPROTO board, solder the LED to the board.

2.png

Step 4: Next solder in the resistor and complete the circuit using a wire.

3

Step 5: Now solder in the LDR (Light Dependent Resistor), its accompanying resistor and complete the circuit using another wire.

4.png

Step 6: The next step is to solder in the analogue to digital signal converter (ads1115) into the pi-topPROTO board.

5.png

 

Step 7: Connect the ads1115 to the 5V power supply.

7.png

 

 

Step 8: Connect I2C connections (SCL and SDA) on the ads1115 to pin 5 and pin 3 on the board respectively.

8.png

 

Step 9: Connect the ADDR pin to the GND pin on the ads1115 so as to define the I2C address on the ads1115 as 0x48.

9.png

 

Step 10: The next step is to move onto the python code! This can be done on your pi-topCEED. After you have booted your pi-topCEED up: click on the Main Menu, accessories and then open up a terminal window as seen in the screenshot below.

2016-06-02-132709_1366x768_scrot

 

Step 11: Type in “sudo idle &” into the terminal to open up idle 2 which will allow you to create a run python scripts on the Raspberry Pi!

2016-06-02-132941_1366x768_scrot

 

Step 12: Once the python shell environment has opened up, click File and then New to open up a new text editor. This text editor is where you will type your code, save and run the project! Once you run the project on the text editor the results will be displayed on the python shell environment that was previously mentioned.

2016-06-01-113610_1366x768_scrot

 

Step 13: The next step is to now copy the code below in the python text editor:

import matplotlib.pyplot as plt

import matplotlib.animation as animation

import time

import Adafruit_ADS1x15

import pylab

import numpy as np




from scipy.interpolate import interp1d

from scipy.signal import butter, lfilter, filtfilt




# from scipy.interpolate import spline

#get plot and draw axes

fig = plt.figure()

ax1 = fig.add_subplot(1,1,1)

moving_y = []

xaxisthings = []




startTime = time.time()




secondsShown = 5

secondsCalc = 5

plotHz = 20                        

totalWidth = plotHz*secondsShown

Oversample = 5




allY = [0]*plotHz*secondsShown

allX = [0]*plotHz*secondsShown

       

#function to set the next y value

def new_y_value():

   time.sleep(1/(plotHz * Oversample))

   return Adafruit_ADS1x15.ADS1115().read_adc(0, gain=16)

              

def animate(i):

   #add a new y value, and remove the first

   totaly = 0

   totalx = 0

   count = 0

   for j in range(secondsCalc * plotHz * Oversample)

       totaly +=new_y_value()

       totalx +=time.time()-startTime

       count+=1

       if count == Oversample:

           allY.append(totaly/Oversample)

           allX.append(totalx/Oversample)

           count = 0

           totalx = 0

           totaly = 0




   while len(allY) > (secondsShown*plotHz):

       allY.pop(0)

       allX.pop(0)

   

   ax1.clear()




   ax1.plot(allX,allY)

ani = animation.FuncAnimation(fig, animate, interval=1)

plt.show()

2016-06-01-113833_1366x768_scrot.png


 

Step 14: After creating your code, click on “File” and then “Save as” to save the code that you have written so that you can come back to it and run the code whenever you want!

Step 15: After saving your code, put you finger in between the LED and the LDR and press F5 to run your code and see your heartbeat displayed across the screen as seen in the image below!

Heart Rate Monitor.png
2

CEED Universe Compass Tutorial

This is the second tutorial in our trilogy. If you missed the first – please check out our Light It Up! – LED Tutorial for pi-topCEED.

Components needed: 

  1. LED x 4
  2. Resistor(100Ω) x 1
  3. Wires x 8
  4. pi-topPROTO board x 1

 

Background: Now that you know how to build one LED, we can step it up to the next level and build an LED compass. This can be useful when you are travelling or lost your way through the vast CEED Universe. Check your direction by using your own LED compass to guide you

Step 1: In this tutorial you will learn to make a compass on an LED circuit on the pi-topPROTO board.

Step 2: Below is a image of how the circuit should be connected with the LED soldered in place first (please follow the link here to take you to our video showing you how to solder onto a pi-topPROTO board).

led_compass_schem 1.png

Step 3: The next step is to solder the resistor in place.

2.png

Step 4: The next step is to solder the wires that connect the LEDs to the GPIO (General Purpose Input Output) port pins that will detect the signals being sent from the code when the CEEDUniverse game is being played so that you can see if you are getting closer or further away from your target destination. To learn more about GPIO pins please follow the link here.

3.png

Step 5: Once the circuit has been soldered in place (please follow the link here to take you to our video showing you how to solder onto a pi-topPROTO board,) all you have to do is slide the pi-topPROTO board into the HUB and run the CEEDUniverse game to use the compass! You can watch a short video showing you the final product below. 

 

 

 

1

Light It Up! – LED Tutorial

Today we are ecstatic to announce that we have started shipping out our pi-topCEED. To get you started we’ve prepared a trilogy of projects. Let’s start the plug & play!

Components needed: 

  1. LED x 1
  2. 100Ω Resistor x 1
  3. Wire x 1
  4. pi-topPROTO board x 1

Background: LEDs are a particular type of diode that convert electrical energy into light. In fact, LED stands for “Light Emitting Diode”. They are all around us in daily life: in our phones, our cars and even our homes. It is highly likely that when something electrical lights up – there’s an LED behind it. For more on LEDs check out this link here.
Step 1: In this tutorial you will learn to make your first LED circuit on the pi-topPROTO board, that can be found by following the link here.
Step 2: This image below shows you diagram of the LED circuit and an empty pi-topPROTO board onto which the projects can be built!

 

led circuit_schem  1

 

Step 3:

  • Below is an image of how the circuit should be connected, with an LED, 100Ω resistor and a wire to complete the circuit.
  • The resistor is connected to ground and the negative terminal of the LED; a wire is connected to the 3V3 power source and the positive terminal of the LED. The longer of the two LED terminals is the positive terminal.
1

 

Step 4: Once the circuit has been soldered in place (please follow the link here  or watch it belwo, to take you to our video showing you how to solder onto a pi-topPROTO board,) all you have to do is slide the pi-topPROTO board into the HUB!

We would warn you to be very careful with soldering and take the necessary precautions! 🙂
If you are interested in learning more about LEDS please follow the link here. Or, continue with the next Tutorial: CEEDUniverse Compass Tutorial.