Learn, Play & Create

Spooky pi-topHALLOWEEN Tutorial

Give your pi-top or pi-topCEED a haunted feel this Halloween with this spooky jack-o’- lantern tutorial!

Before we get started, this is the boo-tiful equipment required to achieve the ghastliest effects:

  • 5x yellow witches boil LEDs
  • 1x blood red LED
  • 6x 100 Ω reVolting resistors
  • 1x pi-topPROTO (or breadboard)
  • A few standard wires
  • 1x acrylic slice (included with your pi-top or pi-topCEED)
  • Access to a laser etcher (optional)
  • 1x pi-top or pi-topCEED

So, let’s get started by transforming our pi-topPROTO board into a magic dancing candle.


Step 1: Wire LEDs to your pi-topPROTO board

Screen Shot 2016-10-28 at 17.53.37.png
  • The red LED should be wired to pin 22(GPIO 25) on your pi-topPROTO board
  • The yellow LEDs should be wired to pins 11(GPIO 17), 13(GPIO 27), 16(GPIO 23). 29(GPIO 5), 32(GPIO 12)

The red and yellow lights will create a spook-tacular orange hue for your laser etched jack-o’- lantern acrylic slice!

Step 2: Wire LEDs to ground

Screen Shot 2016-10-28 at 17.55.35.png
  • Wire the cathode (negative pin) to the ground rail on your pi-topPROTO board, to keep things neat we have done this on the back of our pi-topPROTO board as seen in the image above!

Step 3: Use resistors to connect your LEDs to GPIO pins

Screen Shot 2016-10-28 at 17.57.45.png
  • Next, we need to wire the yellow LEDs to RPI pins 11, 13, 16, 29 and 32
  • The red LED should be wired to pin RPI pin 22
  • This will complete the full circuit

Now, we are almost there! Put the following Python code into the pi-topCODER editor and click run to test it:

import random
from time import sleep
from gpiozero import PWMLED

RED_LED = PWMLED(25)

YELLOW_LEDS = [
    PWMLED(17),
    PWMLED(23),
    PWMLED(27),
    PWMLED(5),
    PWMLED(12)
]

while True:
    RED_LED.value = random.uniform(0, 0.5)

    for led in YELLOW_LEDS:      
        led.value = random.uniform(0, 0.5)
    
    sleep(random.uniform(0, 0.5))

The code uses randomised pulse width modulation (PWM) in order create a candle flicker effect!

Finally, we need to etch our spooky acrylic slice – the design can be downloaded in docx format (see below). We recommend you convert it to a dxf file that can be used with a laser etcher 🙂

Download the docx file here: halloween

Here is our ghastly haunted pi-top acrylic slice:

screen-shot-2016-10-28-at-18-09-43

Eerie green halloween……. 😉

So, for the final effect. Let’s run our code again!

Here is your spooky phantom pumpkin finished project!

halloween.gif

How to install pi-topOS to a microSD card

A simple guide for anyone who wants to install pi-topOS to a microSD card.

Prerequisites


You will need:

  • MicroSD card
  • A computer with microSD card slot, or an adapter to connect microSD to your computer (e.g. SD or USB adapter)

Next steps are to:

Step 1Download pi-topOS from our website.

Note: Please make sure that you are always using the latest release (you can check this by comparing the date in the filename to the date in the release on our OS download page).

Step 2 – Insert the microSD card that you want to write to into your laptop or PC.

Hint: all of our microSD cards ship with an SD card adapter, and you will likely need to use this (or a microSD-to-USB adapter) to connect to your computer.

Let’s get started!


There’s a great tool called Etcher, created by an Internet of Things company called Resin.io. This software has been specifically designed to write operating systems to SD cards and USB drives.

It works the same on Windows, Linux and OS X (trust us – we’ve tried!) and is incredibly easy – with only 3 steps!

1) Select the zip file that you just downloaded. You could extract the image onto your hard drive first, but Etcher is clever and extracts the file whilst it writes, so why bother? 🙂
2) Select the SD card from the list. If there are multiple drives that are available, make sure that the drive you select is the correct size, to prevent writing to the wrong drive. If you are not sure which drive to write to, then remove all other drives until only the SD card is in the list.
3) Click ‘Flash’!

 
That’s it! Etcher will install pi-topOS for you (AND it also verifies that it was 100% correctly written). Then all you need to do is plug the microSD card into your Raspberry Pi, and switch on the device.

 
If, for some reason, this is not working for you, then check out this blog post for another way to get it working or reach out to us via support@pi-top.com

All the best,

pi-topTEAM

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

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. 

 

 

 

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.