Skip navigation
2013

My family and I (wife plus two young children) are away travelling the South Island of New Zealand for our summer holiday.  At least one of the places we are staying hasn't upgraded their TV to go digital, the owners usually take their Sky decoder with them.  With our car already loaded to the gunwales with a double buggy, two kids car seats, buckets and spades for the beach, fishing rods, a small selection of christmas toys, and enough clothes to cover four seasons, packing anything extra was out of the question.

 

The plan was to take the Raspberry Pi Media Centre loaded up with RaspBMC and my laptop (which was going on holiday too).  I had loaded up ISO images from a few of the kids favourite (legimately purchased) DVDs as well as one or two for the grown-ups.  The Pi could be hooked up to the TV, and after a long day at the beach the kids could enjoy a bit of The Wiggles or Hi 5 while winding down for the day.  True, I could have just used VLC or something similar on the laptop, but the laptop can't beat a 48" display when several people are watching, and curious little fingers are kept well away from my laptop! :-)  A bit of research has revealed that playing ISO images is not straight forward with XBMC but there has been quite a bit of work done on this recently and people seem to be getting better milage with the built in player.  I also realised I was probably going to need an MPEG2 codec licsense to get this working.  I figured there was probably going to be a bit of tweaking involved to get all of this working successfully.

 

The media center also offers a whole host of other options via the myriad of add-on plugins.  As a big fan of NASA TV and Youtube, there were plenty of options available there.  And if I had the time then I might also try and get the MythTV backend up and running on my laptop with a USB DVB-T tuner and using RaspBMC as the front end.  Finally, with the addition of an Element 14 WiPi there was a possibility of hooking up directly to my iPhone's wireless hotspot.

 

As it turns out NZ Customs were overloaded with the extra Christmas post and although dispatched promptly by the team at Element 14, the Rasperry Pi Media Center kit hadn't arrived by the time we had cleaned up all the leftovers from Christmas Day, loaded up the car, and hit the road for sunny Nelson.  Having prepared for this possibility, I already had a spare Pi floating around, and downloading and installing RaspBMC image was quite strait forward.  I don't have the mini keyboard and trackpad, or the Pi Control and Display (which to be honest I haven't figured out how I'm going to integrate that yet).  The keyboard will be dearly missed though as already using just a wireless mouse with limited range for the initial install and configuration has tested my patience more than my 11 month old son's glee in fiddling with the controls on the home theatre.  He can't walk and he can't talk but he sure knows how to wind up his old man!  So all is not lost and my review will probably be in two parts, the first related to our experience with the cut-down backup version while travelling and the second related to the full blown kit once we return home and organise for the courier to redeliver.

Before you watch this project... see my others:

- The "Scary Door"

- "Project Goldie"

 

 

C

http://twitter.com/Cabe_Atwell

 

New Year’s Eve (NYE) is always fun, especially when something fun happens at the zero time. Launching fireworks seems to be the default response to the calendar change. Having it do off exactly as the year comes to a close is key. The person that is often required to light those wicks loses out to enjoying that moment. (They have to be on the ready to do whatever task is needed…)

This project is for those lonely and wayward souls 

 

This setup and forget countdown timer that activates 10 relays for the last 10 seconds of the year. Like a switch, a relays can turn on/off anything that can be turned on/off. So, this project could just turn off all the lights in a house for a dark and private NYE, to blaring ten electric boat horns for the annoying party.

Do anything you want with the relays… I chose to launch a single firework at the zero second. I chose this mainly to give a simple way of handling launching of fireworks remotely. (I would like to add, much safer too. No more light the wick and run like crazy…)

 

Here were my requirements of the “CANYECT WFLA”:

  1. Grab the time from the Raspberry Pi clock.
  2. Countdown from any time showing DAYS:HOURS:MINUTES:SECONDS
  3. As the timer get closer to zero… it will truncate what is not necessary anymore, starting with days. Then hours, and finally minutes. On the last 15 seconds… the last numbers will fill the screen.
  4. On the last 10 seconds of the countdown, the RPi will activate (or deactivate) 10 relays.
  5. (For my example) Launch fireworks on the last second, wirelessly.

 

Project by sections

 

Hardware:


At the core of the project is the Raspberry Pi Model B Rev 2. Between it and the Sainsmart 8-relay board is a set of Adafruit Logic Level Converters. The Raspberry Pi GPIO pins only output 3.3V data signals… and the relay board is looking for a 5V potential to indicate a switch. The logic level converter handles that boost. You could build your own level converters with a 2N222 transistor as some resistors, but who has time for that?

From the relays board, I have bypassed one of the buttons on the JM70A Wireless Remote Control 4 Channel Kit. Why such a crude hack of the remote? I wanted to put together a simple wireless setup. I had a few wireless relays in my junk electronics, finally wanted to put them to use. For this project, I only needed one wireless relay.


I simple soldered wires to the either end of the JM70A button “A.” From there is connected to the last relay on the SainSmart 8-relays board on the “Normally Open” terminals. When the relay board is switched, the remote will think its button “A” is being pressed. That simple.

At the business end of the project is the 4-relay board, part of the JM70A kit. This board has four relays that could be used. I only needed one. To the Normally Open (NO) terminals of the relay I will activate, I attaches wires that connected to two CR123 (3V) batter holders in series (6V total), then to one lead of an Estes Model Rocket Igniter. The other lead connected back to the other NO connection on the relay.


When the relay is witched, 6V will dump through the Estes Rocket Igniter, which starts to burn. The Igniter is taped to the fuse/wick of the Fireworks I want to launch… the igniter burns.. so does the fuse.


Fun is launched.

 

You do not need to go wireless. Just use wires directly from the SainSmart relay board to your Igniters or whatever you are activating. Keep in mind, the longer the wire, the more resistance. You could attenuate your data signal. Test ahead of time.

I just wanted to not lay wires down like a WWII communications soldier. And.. I wanted to keep the Pi and parts safe from the burning materials.

 


Schematic and Design


Click to zoom in! (Build at your own risk...be advised!)

CANYECT WFLA LE1.jpg

Click to zoom in! (Build at your own risk...be advised!)



The difficulties

 

- The Estes Model Rocket Igniters, the ones you find in model rocket kits, are extremely delicate. Move it around too much, and the part that burns will break. There are plenty of sites that talk about building your own igniters.. However, I wanted something that is manufactured to work… but more importantly, available on Amazon.

Be careful with handling these. Also, keep in mind, they get “burn to the bone” hot, handle with caution.


- For some of us, NYE is a cold day. Although cold electronics often work better, batteries do not. I had trouble with some fireworks launch tests not working. I used a hardware store heat gun to warm them up before tests. Worked like a charm.

Alternatively, insulating the batteries is a good idea.


- The JM70A, both the control fob and the relay board needed 12V. The key fob had a battery holder, the relay did not. I bought a battery holder for a small 12V battery (N type). The relay board would be good for a few tests before the battery wore out. To about battery issues, I connected a 12V wall power supply to the key fob. Also, it saves a lot of batteries that way!


- Remember that the fuse on fireworks give some time for people to light and run away. So, if you set it at the zero mark, it will then take X amount of time to burn down. To account for this, I cut the fuse down quite a bit. Since I did not need to be near it to light the fireworks, I made it as short as I could. Also, placing the output at an earlier time could time it all better. IE: If is takes 3 seconds to burn a fuse, move the output to the relay for “3 seconds to go.)

 

 

Code (Build at your own risk...be advised!)


Everything you need to compile is attached to this post. Download, compile, and set up the relays.

 

To do a test of the countdown, press “Ctrl-T.” Each time you do, it will get closer to the last 15 seconds.

 

 

 

BOM

 

CANYECTWFLA BOM
DESCRIPTIONQUANTITYUnit PriceVENDORVendor Part#PRICE
Fireworks (Roman Candles, etc)3$7.00FW StoreNA$21.00
Estes Model Rocket Igniters (6 Igniters per pack)3$8.00Local Hobby Store2301/2302$24.00
Zitrades (SaneSmart) 5V 8 Channel Relay Module for Arduino DSP AVR PIC ARM1$14.25AmazonNA$14.25
Palm Touchpad 5V 2A microUSB power supply1$5.00AmazonNA$5.00
4-channel I2C-safe Bi-directional Logic Level Converter3$3.95Adafruit757$11.85
Raspberry Pi Model B2$35.00element1443W5302$70.00
PRE PROGRAMMED, MICROSD, 8GB, RASPBERRY PI1$17.99element1497W1422$17.99
BREADBOARD, SOLDERLESS, 400 TIE POINTS1$7.35element1456T0249$7.35
BUDGET PACK, RASPBERRY PI (Mostly unused, only for parts)1$49.95element1444W3511$49.95
BUD Boardganizer2$16.32element1488W3963$32.64
Total$254.03
Items found or for free
HDMI and HDMI to DVI cables
Keyboards and mice
Power strip
ASUS 24" LCD1$100.00EbayNA$100.00
Magnets, wire, wire nuts, solder,



 

Other uses of the system

Anything that can be turned on with or like a switch.

10 Creepy talking dolls

10 Old TVs on "no signal" fuzz

10 Appliances in someone’s house

10 Fibonacci sequenced CANYECT WFLA projects (advanced… and sounds insane)

 

C

See more news at:

http://twitter.com/Cabe_Atwell

Hi all,

 

The latest update on my project; using the raspberryPi as a controller for a hydrogen fuel cell with the intent on powering a remote controlled plane.

 

Hope you find the video interesting and inspiring, if so please click LIKE!

 

Regards,

 

Simon

 

shabaz

Sleepy Pi Overview

Posted by shabaz Top Member Dec 14, 2013

Introduction

The Sleepy Pi is a board produced not a million miles from my home town, and it is designed to extend the Raspberry Pi (RPI) capabilities. After having examined it, the conclusion is that the board is fantastic with a rich set of functionality and extremely well-designed, and it will provide tremendous value for projects with the types of requirements listed below.

L1060360.jpg

This board should interest people with any of these requirements:

1.    The ability to run the RPI from a battery

2.    The ability to run the RPI intermittently (based on events or time), perhaps over days/months from a remote location

3.    Interface to hardware and run microcontroller code

4.    Use existing Arduino compatible boards

5.    The ability to keep time without a time server on the Internet

It opens up some unique opportunities.  For example you could shut down the RPI, collect data using the far lower power  in-built microcontroller on the Sleepy Pi, and then periodically wake up the RPI and send the data to a server. The RPI could run for days/weeks/months like this at a remote location.

 

Main Features

The main features are:

1.    Provide battery backed up clock (it has a socket for a watch type cell)

2.    Provide efficient, regulated power to the RPI (there is a built-in DC-DC converter and a DC barrel socket) – or use your existing power supply (there is a USB socket for that)

3.    Allow the RPI to be put to a ‘deep sleep’ (power off) and awakened at certain defined times or when a particular event (analog or digital input) occurs

4.    Allows external hardware to receive a switched power supply, so that it can be put to sleep too

You can see the RTC back-up battery socket on the underside (battery not supplied due to postal restrictions - a CR1632 cell is needed for enabling that capability):

L1060361.jpg

The diagram here is from the Sleepy Pi website:

sleepy-pi-block-diag.jpg

This photo shows the mapping of where bits of functionality are located on the board:

L1060362-annotated.jpg

Owing to its design, it has some very attractive additional advantages:

1.    Arduino compatible boards can be plugged in on top, for extending usefulness

2.    There is an on-board Atmel AVR microcontroller – on of the world’s most popular microcontrollers – which allows for some relatively high speed interfacing to hardware without the varying latency that Linux would incur

3.    Decent area for prototyping – saves an additional board

4.    Built-in ADC (in the AVR chip) for connecting to analog sensors (two 10-bit analog channels)

5.    Additional 'peripherals' available inside the AVR chip, such as PWM for controlling analog devices or for light dimming/motor control (requires additional circuitry)

 

Design Overview

There are many bad and good boards out there, this one falls in the extremely good category.

Hardware Design

The design is really nice – the list of good points seems endless: sensibly, it is a rectangular board without strange cut-outs (which save little space and wouldn’t allow the PCB to fit many cases anyway) so it allows for a usable prototyping area which is really nice. There is space for screw terminals and Arduino headers. All connections are well labelled.

Many connectors are supplied, so you can use the board as you wish. The existing RPI 26-pin connector is not totally consumed and lost; there is an inline header so that additional boards could in theory become part of the sandwich.

The board is securely fastened to the RPI using hex spacers (you will need a 2.5mm hex driver for the supplied bolts). As a design suggestion, perhaps some more holes on the Sleepy Pi would be good, so that it can be bolted into a case. Extra holes may be hard to implement because the board is so packed. A good workaround is to use hex spacers with male thread on one end, so it is a very minor point.

It is nice that decent hex bolts are supplied (this controls the amount of space the head consumes around the board) and insulating washers for the paranoid (like me). I’m really struggling to find a bad point about the Sleepy Pi.

I’d suggest one additional hole, so that it can finally fix the RPI weakness of two holes, since a total of three holes will allow it to firmly be fixed to a surface.

As another suggestion, perhaps a couple of very small holes near the battery, so that it can be tied down if desired and not vibrate/drop out (people may use the Sleepy Pi in some extreme conditions), especially since it is on the underside of the board.

As far as I can tell, the board does not foul up any existing connector on the RPI, including the camera connector.

AVR Microcontroller (Arduino)

In normal (expected) use, no additional hardware is needed and you will be able to run Arduino code directly on the Sleepy Pi.

If required, there is a 6-pin Atmel AVR header for an external programmer. This will allow you to run code written without Arduino support too.

Note that as far as I can tell, the board could in theory even be used independently of the RPI. So, if you happen to need an AVR microcontroller and RTC and DC-DC supply to power your electronic circuit, then this board could be useful for that purpose too.

If you don’t wish to go Arduino-mode and wish to program the AVR yourself, then a programmer is available for under £20($30) (Olimex AVR-ISP-MK2) from Farnell/Newark and it will plug in directly to the Sleepy Pi. I’ve not used it, but it is worth a try – since the Atmel version AVR-ISP 2 is a little tricky sometimes to set up with Windows 7.

The AVR is a great introduction to microcontrollers and has so many uses and existing code snippets available all over the Internet.

Circuit Design

Looking at the schematic, it all looks very nice – decent protection on the power inputs, very good power control using MOSFETs (with protection too), unlike some RPI power control designs which use relays, and the design looks an extremely good quality (a few tantalum, and mainly ceramic caps everywhere as expected for this type of design) and decent modern component selection everywhere.

This is the type of design someone would do for themselves and be proud of the result, rather than a design intended for sale at a reduced price point with a compromised quality.

In the spirit of open source, the schematic is available and any code is on Github. This is a really important because many RPI boards are intended for educational use yet the creators hide the design (maybe they should be named and shamed!) because so much can be learned from looking at the design detail.

Prototyping Area

The prototyping area is of the round isolated rings variety, which is amongst the most useful – it can be used for through-hole parts but also for soldering up surface-mount devices sometimes and joined with thin bare wire.

 

Summary

It is no surprise if you’ve read the above - this is an impressive board. It is well designed and packed with features. The cost may seem high (£36.99 including VAT) but it does what you would previously have needed several boards to do, and good parts cost money - the design is of a very high quality.

Introduction

This was a fun project to try to make some flashing lights. Of course, it needed to be a bit more complex than that so a Raspberry Pi was used for Internet connectivity, and some analog circuitry was used to generate multiple PWM outputs to drive strings of lamps. Everything can be dimmed or particular patterns selected from any web browser. For a holiday look, the lamps were enclosed in star-shaped laser-cut acrylic. All the steps are detailed here if you wish to build something similar.

whole-project-working.jpg

The controller board was built in two evenings after work, and the strings of lamps can take a few hours to assemble; so this could be a weekend project.

Even if you’ve already have your holiday lights arranged by now, this post may be useful for the following information:

•    Using 555 timers

•    Controlling a DAC using the Raspberry Pi

•    Controlling hardware using MOSFETs

The source code is also useful if you have other requirements for controlling or retrieving status information from software or hardware using a web browser.

 

The project uses low voltage lighting for safety and hardware PWM to greatly simplify the software. The software is simplified further by utilizing JavaScript as the main programming language; the entire project occupies just three small files.

 

The plastic parts are possible from most laser cutting services; however if you contact Problemchild he has the design files and can supply a very good quote for these shapes in various translucent colors. The plastic shapes in this post used John’s laser cutting service.

Here is a video of it in action running one of the patterns (it can handle multiple patterns all controllable via the web browser including pattern speed):

 

This is the actual controller board (it was stacked under the Raspberry Pi in the earlier photo):

whole-project-working-unstacked.jpg

 

Solution Overview

The diagram here shows how it all works. The user controls the whole thing from a web browser. The controller board powers four channels of lighting. The light strings can total 12V or 24V for flexibility and can be powered with a small mains adapter. These low voltages mean that the project is safe.

simplified-overview.png

The project here used 5V lamps and chained five of them in series for each channel, i.e. totalling 20 lamps run from 24V. It is also possible to drive lamps in parallel if desired, if longer lengths of lighting need to be driven.

 

The project can be split into two halves; Part of it is software, and part of it is in hardware. You can skip the design descriptions below and go straight to the build if desired.

 

Software Design Overview

The software needs to do a few things; serve up and handle web page interaction, implement a lighting patterns using some sort of timer for animation, and to drive some of the pins on the RPI (general purpose I/O pins) to control the hardware which will drive the lights.

 

There are many ways to achieve these tasks; in this case, a software platform called Node.js was predominantly used (thanks fustini ). It allows most of the software to be written in JavaScript, and also eliminates the need to install a heavy web server such as Apache, because a lightweight web server is available for Node.js. It reduces the need to use another programming language; the code that will be written to run on the RPI will be in the same language as the software that will run in the web browser as coded in the HTML file.

 

Note that a very tiny piece of software is written in C; that bit of code is the interface to GPIO.

 

To summarise, just three files are needed; the Node.js program (written in JavaScript), the HTML file and the C program that will write to the controller board over GPIO. These three files are attached in the zip file at the end of this post.

 

The small C program is called ‘dac’ (predictably it is used to control a DAC on the controller board which adjusts the channel brightness as will be seen later). The program can be executed from the command line using:

./dac <chan> <value>
    

where the first parameter corresponds to a channel between 1 and 4, and the second parameter sets the brightness value between 0 and 255. In our case, the Node.js program software directly calls the dac program.

 

The diagram here shows a graphic view of the software components that will be running inside the RPI. The three software files are shown in green (index.js JavaScript file), blue (index.html file) and red (the dac.c program). It is all fairly self-explanatory if you view and compare it with the code.

software-overview.png

Hardware Overview

There are many ways to generate PWM; the design here uses a 555 timer chip to create a fixed-frequency sawtooth waveform that is continually compared to an adjustable voltage from a DAC. Whenever this DAC adjustable voltage exceeds the sawtooth level, the string of lamps is switched on using a MOSFET. By using quad DAC and quad comparator ICs, the circuit allows for 4 channels to be independently controlled (just one channel is shown in the diagram below for simplicity).

hardware-overview.png

 

Building the Circuit

The circuit can be built in 4 portions (5V regulator, sawtooth generator, comparators+MOSFETs and DAC) with each part tested before moving to the next part. No special equipment is needed to test; a multimeter and a pair of headphones are sufficient.

 

The circuit was created on prototyping board of the circular ring variety (sometimes known as perfboard), but stripboard could be used too if preferred. With the circular ring type board, the components are soldered in position and then very thin bare wire can be used to make traces on the underside (other ways are possible too).

 

The photo below shows the mapping of the bits of circuit;

Blue: regulator circuit

Green: sawtooth generator

Red: comparator

Purple: MOSFET outputs

Yellow: DAC

board-highlighted-closeup.jpg

 

Physical Layout Diagram

The entire layout is shown here and can be used as-is, or if you want the boards to stack then a minor change is that a couple of parts need to move slightly to accommodate the screw holes that need to be created in the prototyping board.

board-layout-guideline.png

As mentioned, most of the wiring occurs on the underside of the board using thin bare wire. Note that capacitors C6 and C9 are soldered on the underside too, to keep wire lengths short. Each portion of the build is described in detail below but refer to the physical layout diagram above as you are building each portion.

 

The first step is to drill holes if you desire the boards to stack:

board-holes-med.jpg

At this stage it is worth attempting to assemble the RPI on top to ensure that the holes are in the correct position before proceeding further.

 

5V Supply

Most of the circuit operates from 5V, but the lamps require a higher voltage since they will be chained together. A 78L05 voltage regulator circuit was built, and then tested with a multimeter before proceeding further. The 78xx series regulators are extremely common and used in a lot of projects. The ‘L’ variant is used for low power applications. The DC socket J1 is available in thin and fat center pin variants and usually the correct one is needed to match the power supply. To save headache, use the recommended socket which has a compressible diameter center pin that can handle both thicknesses of the mating plug.

regulator-circuit2.png

Once you have built up the regulator circuit, check with a multimeter on the unpowered circuit to ensure there are no obvious faults like a short circuit between the +24V, +5V and 0V wires. Once this is done, power it up and confirm that you can successfully see the 5V output.

 

Sawtooth Generator

The sawtooth generator consists of a 555 oscillator chip combined with a single transistor constant current source. The sawtooth waveform is taken from the capacitor, instead of pin 3 of the 555. The 555 is an extremely popular chip – see here for fifty more ideas.

sawtooth-circuit2.png

With the two capacitors C3 and C4 as shown in the circuit diagram, the frequency of oscillation is quite low (a few kHz) so that it is possible to test the circuit easily without requiring an oscilloscope, before proceeding further.

 

To test the circuit, connect up a low cost pair of headphones to pin 3 of the 555 and to ground in series with a small capacitor (100nF is fine). You should hear a high-pitched tone. If this is successful then the circuit so far works well. The test is complete! Unsolder or cut out the C4 capacitor to increase the frequency to a usable level for the project. The frequency will now be approximately 15kHz.

The diagram here shows the generated waveform.

sawtooth-annotated.png

PWM Generator and Output Circuit

The PWM signal is created using a comparator chip. As the name suggests, such a device can compare two inputs and the output becomes high or low depending on which input is higher than the other. By supplying a fixed frequency sawtooth as one input to the comparator, it is possible to generate any pulse width (up to the period of the sawtooth) by adjusting a voltage level on the other input of the comparator. If you want to see this as an animation, click here (java needs to be installed).

You will see a screen similar to the one below. By adjusting the slider at the bottom-right, the PWM level can be adjusted and is reflected in the animated waveform displays. Note that this simulator is useful for testing out other circuits too.

falstad-sim.png

The actual circuit is shown below. The output of the comparator is known as ‘open drain’ which allows it to be connected up to a higher voltage. Five lamps are connected in series (each one is rated for 5V), which is ideal for powering from a small 24V mains adapter. The circuit is repeated four times so that multiple channels of lights can be controlled. Refer to the table to the left of the circuit below for the pinout for the LM2901 chip which contains 4 comparators inside.

pwm-and-output-circuit2.png

Once this part of the circuit is assembled, it is possible to test by applying a controlling voltage (using a variable resistor) to pin 7,5, 9 or 11 of the LM2901 IC and observe the dimming action of the lights. If the lights have not been assembled, you can use a single LED in series with a 2.2k resistor.

 

The traces below show the signals probing at various points in the circuit. As the controlling voltage is varied, the width of the blue and purple pulses will change.pwm-waveforms-annotated.png

DAC Circuit

The final part of the circuit is the quad DAC implementation that will interface between the Raspberry Pi and the comparators. A reference voltage of about 3.8V is created using resistors R14 and R15 (potential divider circuit). This provides a fraction less than 8 bits of resolution for the lamp dimming action – it is more than sufficient for this use-case. The IC has four analog outputs, one for each comparator. The IC is loaded with the desired levels using a three-pin interface consisting of CLK, LOAD and LDAC pins. These are manipulated using software.

dac-circuit2.png

 

Hardware Checks

Run a few checks on the circuit to confirm all is well. For all these tests, do not connect up the board to the RPI.

1. With power off, confirm no short between +24V, +5V and 0V lines with a multimeter

2. Confirm that the +5V connection on the DC connector J1 is connected to the power pins on the three ICs

3. Confirm that the 0V connection on J1 is connected to the 0V pins on the three ICs and to the MOSFET source pins

4. Now power up, and confirm with a multimeter that the regulator delivers 5V, and confirm that the regulator is not hot - it should be between cold and about body temperature if all is working well

5. If you did not do it earlier, confirm with headphones and a 100nF capacitor in series that you can hear a tone as described earlier. Once this is confirmed, snip or desolder the C4 capacitor.

6. Place a 10k resistor between the DATA pin of the DAC and 0V (this is easy to do by pushing the resistor into the jumper cable socket that will connect the controller board to the RPI. Place a multimeter across the resistor and confirm that you see 0V. Repeat for the other two signals that will connect the two boards together.

 

Software Installation Details

The steps at this site were used to install node.js, modified slightly:

From the home directory (/home/pi):

mkdir –p development/light
mkdir mytemp
cd mytemp
wget http://nodejs.org/dist/v0.10.21/node-v0.10.21-linux-arm-pi.tar.gz
tar xvzf node-v0.10.21-linux-arm-pi.tar.gz
sudo cp -r node-v0.10.21-linux-arm-pi/* /opt/node
    

The above will result in the node executable being placed at /opt/node/bin being installed.

 

The /etc/profile file needs two lines added before the line that says ‘export PATH’. To do this, type

sudo vi /etc/profile
    

(assuming you know how to use vi; otherwise use an alternate editor). These are the two lines to be added:

NODE_JS_HOME="/opt/node"
PATH="$PATH:$NODE_JS_HOME/bin"
    

Then, reboot the RPI:

sudo reboot
    

 

Once it comes back alive, the next step is to install socket.IO:

cd ~/development/light
npm install socket.io
    

The above command will take about 5 minutes to complete.

 

Now, In the mytemp folder, type the following to install an excellent GPIO library by Gordon (unfortunately I don't know the last name):

cd ~/mytemp
git clone git://git.drogon.net/wiringPi
cd wiringPi
./build
    

The above will download, compile and install the wiringPi library into /usr/local/lib.

 

Place the dac.c file that is attached to this post into the development/light folder (and also the index.js and index.html files while you are at it), and compile it as shown here:

gcc -o dac -lwiringPi dac.c
    

 

The software part is now complete. As a simple test, connect up the controller board to the RPI, plug in the 24V supply (you don’t need to worry about any power-up sequence) and use the command below then confirm with a multimeter that the DAC output pin 12 goes to about 3.7V.

sudo ./dac 0 255
    

The first parameter was the channel number (0-3). If any lights were connected to channel 0, then they would now be lit up (We still need to make the lights, they are described further below).

The lights on channel 0 can be dimmed to any value, such as:

sudo ./dac 0 128
    

To turn the light off:

sudo ./dac 0 0
    

You should see the DAC output on pin 12 vary accordingly as the commands above are entered.

 

Constructing the lights

Depending on your needs you could construct the chains of lamps in different ways. A general topology is shown in the diagram here.

lamps-overview-and-dimensioning.png

The four chains can be bundled together and secured with a small piece of clear heatshrink tube or glue or tape (or twisted together). As expected, the chains are staggered so that light ripple effects run across the bundle. For a thinner bundle although four return wires are shown, they could be reduced to a single wire going to the +24V supply that is common to all four channels.

 

Since this is a custom design you may wish to adjust the lamp spacing for the exact perfect length. There is an excel spreadsheet attached to this post that lets you enter in parameters, and it will calculate the lengths of all the wires (but do add an additional centimetre to the drop length, to allow for wire stripping).

You also need plastic shapes (here are some common translucent colors).

raw-plastic.jpg

The steps to assemble each lamp are described in the sketch here but also in the photographs further below. The clear or colored translucent plastic shapes can be built up to the desired thickness by securing with clear tape along a couple of edges. This means it can be changed the following year if you want a different color scheme.

lamp-assembly-rendering2.png

The lamp assembly is surprisingly fast – just make a couple of holes in the sticky feet (just by hand with a 0.8mm drill bit – no need for a tool), push in the wires, strip the wires about 8mm, twist the lamp onto the wires, optionally solder it, and then attach the sticky feet to the plastic shape with a bit of glue. The wire ends will be kept apart because they automatically fit in between some of the ridges in the plastic shape hole, so no extreme care needs to be taken during assembly (the shaped hole also serves as a lens and to hold the lamp centered).

single-lamp-assembly-steps.jpg

The resistance of each string of lights will be about 23 ohms with the recommended lamps.

This is the final result when lit:

final-lamp-lit.jpg

 

Using the system

Once you have the lights connected up to the board, power it up and go to the development/light folder where the code was placed and enter the following command to start up the program:

node index.js
    

 

Now you can traverse to the web page http://xx.xx.xx.xx:8081/index.html using any web  browser and you should see a lights control panel view like the one shown below. Pressing any button to explore the commands available. There are only two patterns for now but more can be easily added if desired. Pattern speed is adjustable. The status bar will indicate when the RPI has received and processed the commands.

browser-view.png

 

Summary

The lights controller described here allows for 4 channels of dimming and full control from a web browser. Hopefully it can provide further ideas. The software structure based on a Node.js platform can be reused whenever you need to control or monitor hardware remotely via a web browser. The DAC control program, and TI’s 4-channel TLC5620 DAC are ideal for whenever you need a computer-controlled, adjustable voltage for controlling external devices. The MOSFET control described here was fairly simple but is ideal for whenever you want to switch a few hundred milliamps without relays. Portions of the analog circuit were simulated before construction and it is worth getting to know the simulator for trying things out. The actual traces in this post were taken with a Tektronix MSO2024B oscilloscope. The quality of the laser-cut shapes from Problemchild's service was spectacular so I’m looking forward to actually using these lights now. If you are interested in constructing something similar, a parts list is below and the attached zip file contains all the code.

lamps-lit2.jpg

 

Parts List

ID Description Quantity Farnell Part Code

C1 Capacitor 220nF  1 1692301

C2 Capacitor 22uF 50V 1 8766835

C3 Capacitor 10nF 1 1902262

C4, C5, C7, C8 Capacitor 100nF 4 1141777

C6, C9 Capacitor 100nF Axial 2 1902254

IC1 Quad Comparator LM2901N 1 9487697

IC2 Timer NE555P 1 9589899

IC3 TI Quad DAC TLC5620 1 8454493

IC4 Regulator 5V KA78L05AZ 1 1014073

J1 DC Connector 2.1-2.5mm 1 1854512

LMP1-20 Lamp T-1 5V 120mA 20 1139298

Q1-Q4 BS270 N-channel MOSFET 4 1017689

Q5 BC557 NPN BJT 1 9558527

R1 Resistor 2.7k 1 2329509

R2, R4-R7, R15 Resistor 10k 6 9339060

R3 Resistor 1k 1 9339051

R8-R11 Resistor 33k 4 2329515

R12, R13, R16, R17 Resistor 10R 4 9339035

R14 Resistor 3.3k 1 2329522

Misc:

DIL IC socket 8-pin 1 1077344

DIL IC socket 14-pin 2 1077311

Header 40way 2row (cut to 26way) 1 1319210

Proto board (Perfboard) 100mmx160mm 1 1221144

3M ‘Bumpon’ clear feet 12.7mm diax3.5mm 1 2314565

24V 1.25A Power Supply 1 1354829

Terminal block PCB mount 6 way 5.08mm 1 2008008

Wire white 1mm ext. dia. 7 strand 1 1177586

Wire bare 30AWG 1 2290921

Nylon standoff 15mm M3 2 1336157

M3 screw black 6mm 4 1420015

Plastic shapes – order directly by contacting John Alexander

Impact adhesive (UHU or Bostik for example)

Clear tape

 

Files

Zip file here.

As a keen photographer, I was intrigued by what the Point and Shoot Camera could deliver. The bundle is created using the Raspberry Pi, PiFace Control and Display and Pi Camera, all packaged up in some rather smart cases.

 

The set up and execution of the timelapse is brilliantly simple, with the hardest part of the whole project being deciding what the subject should be. One thing I will say is choose a place that will be undisturbed by movement or light – discovering my sunrise timelapse which involved a 5am kick off had fallen over mid-recording, was just a little annoying...

 

What you’ll need:

Photo1.jpg

 

So, first things first – get your kit together:

1 x Raspberry PiRaspberry Pi

1 x PiFace Control and DisplayPiFace Control and Display housed in separate Camden Boss caseCamden Boss case

1 x Pi CameraPi Camera  housed in separate Camden Boss caseCamden Boss case (or Pi NoirPi Noir if you want to record at night)

1 x Portable battery

1 x PiViewPiView (for reviewing your efforts later)

 

Then assemble your kit following the instructions provided.

 

Photo2.jpg

 

IMPORTANT – there are 2 ways to position your camera – I opted for a bit more flexibility by feeding through the gap near the USB which allows the ribbon cable to remain free but you can mount through the SD card end as well.

 

Once you have your lovely camera ready, you need to prep the software.

 

Software for your Point and Shoot Camera

 

Assuming you are using your Raspberry Pi from scratch you’ll need to download the NOOBS software to the SD card from the Raspberry pi Foundation page.

 

Then once you have this, you’ll need to enable the camera software on the PiFace Control & Display. See the set up guide here.

 

And there we go, ready to shoot.

 

Setting up for timelapse shot

 

So next steps are:

 

- Choose your subject

- Choose a position for maximum visibility (if you have time, test the set up of the camera by taking test shots and reviewing). Be careful of reflections – the camera’s red LED will flash at each shooting  so if you place right in front of glass for example, there’s a good chance you’ll see the light or get a lovely red glow.

- Make sure your SD card is cleared of images AND REMEMBER NOT TO OVERFILL – you’ll need to keep some memory back to run the Raspbian to download your pictures. I found a maximum of around 1500 images is fine. The display below shows that there are 1623 photos remaining (not that have been taken). If you want to take more, then getting a larger SD card will solve the problem (I'm using an 8GB).

- Power up your battery and wait for the PiFace Control & Display to boot up.

 

Photo3.jpg

 

- Use the bottom left button to scroll through to ‘timelaps’

- In the bottom left corner of the screen you will see the text ‘S1s1’, these are the settings for the timelapse. The 1st number is the period that the timelapse will take over and the 2nd number is the delay between each photo. The characters before these numbers represent the time unit for this number, currently set to ‘s’ for seconds. Press the 3rd button from the left to set the time unit for the period, and the 4th button for the time unit for the delay between pictures.

You may notice that one of the characters is capitalised, this is the setting that is currently selected, to change this number, flick the rocker switch right or left. Press the 2nd button from the left to switch between the period and the delay. The number of pictures taken is equal to the period divided by the delay between pictures. The number in the top right of the screen is the number of pictures there is space left for on your RaspberryPi, if the settings for your timeplapse will take more pictures than there is space for, you will be notified with an exclamation mark when the timelapse starts.

The ideal length of time between successive pictures will depend on your subject, fast moving and detailed scenes like the car park look better with more frames per second whereas you could expand the delay to every 2 or 3 seconds for a less detailed scene like a sunset. But this is the joy of the project – you need to experiment.

- Make final adjustments

- Push down on the jog wheel to begin shooting.

- Slowly step back and leave alone – the red LED will continue to flash as the camera is shooting.

When the LED stops flashing, the timelapse has been recorded and it’s time to review your work.

- Make final adjustments

- Push down on the jog wheel to begin shooting.

- Slowly step back and leave alone – the red LED will continue to flash as the camera is shooting.

 

When the LED stops flashing, the timelapse has been recorded and it’s time to review your work.

 

Connecting up your Point and Shoot Camera to review photos:

 

Photo4.jpg

 

- Plug your PiView into your Point and Shoot Camera via the USB, take the HDMI connection and connect into an HDMI cable which has already been fed into your monitor.

- Switch the Point and Shoot Camera on via the portable battery.

- A boot up screen should appear on the monitor.

- After the command ‘raspberrypi login:’, type ‘pi’... wait

- After the command ‘Password’, type ‘raspberry’ (you won’t see any characters appearing but it is writing it)... wait

 

Photo5.jpg

 

- After the command ‘pi@raspberrypi ~ $’, type ‘startx’ and Raspbian OS will boot up.

 

Once you’re into Raspbian, you can pull your photos.

- Click on the first icon in the bottom left to display the windows, then open the ‘snap_camera’ foldePhoto6.jpgr

 

- Open the ‘images’ folder to find your images.

 

Photo7.jpg

 

- Copy over your photos

 

Photo8.jpg

 

- Once you’re sure you’ve copied them over, you can remove the images from the SD card so that it’s clean and ready to use straight away.

 

Now you have your photos, download a timelapse compiling software – there are loads of free versions but these have limitations in terms of frames per second or you could go the whole way and purchase a professional version – it’s up to you.

 

- Add your images to the software and play around with the settings to get the speed and effects you’re after.

 

And here is what I made early on a Monday morning, whilst having my first coffee of the day:

 

 

 

And the lovely people over at PiFace have also made their own versions:

 

 

 

howroyd

Hydrogen Fuel Cells!

Posted by howroyd Dec 2, 2013

Hydrogen fuel cells (in particular PEMFCs) are an exciting technology which has been around for a while now. Unfortunately, they haven't really take off (excuse the pun) due to their high cost, poor lifetime and slow transient performance.

 

1. So why are people still interested?

 

Well, firstly you have the good old "clean & green" argument. In operation, the take in oxygen (from the air) and hydrogen (the fuel), and give out heat, water and electricity. No carbon dioxide, monoxide, sulfides and other nasty things.

Secondly, they're not dependent on fossil fuels to run, and are currently the most promising energy generation technology that is independent of the elements (wind, solar, etc).

Hydrogen has a superb energy density, meaning not much weight gives you a huge endurance.

Fuel cells tend to have no moving parts, unless the have a cooling fan or air supply fan, so they are mechanically very simple.


2. So why aren't we using them?

 

They require platinum as a catalyst so make the chemical reactions work. Platinum is incredibly expensive, and more annoyingly it tends to be washed away over time which reduces the fuel cells lifespan.

They are slow to respond, so cruising along at 10% power, then suddenly demanding a full 100% may take anything from seconds, to minutes, to hours, depending on the type of fuel cell. This proves a big challenge in mechanical transport, such as planes, and cars.

Hydrogen is a pain in the rear, generally. To produce the high quantities we need, we can only do it (cost-effectively) by burning fossil fuels. Of course it can be generated using renewables (wind, solar, etc), but this is far too expensive at the moment for the industry to consider.

Hydrogen also is a pain to store. Because there are so few molecules in such a large amount of space (low density), you have to store it at tremendous pressures to get a usable quantity, which requires huge storage tanks. Not particularly practical in transport applications. There are other methods, but cost and practicality is still a huge issue.

 

3. Where do I fit in?

 

To start I am not a chemical engineer. However, I am a PhD researcher for the Hydrogen Fuel Cells & their Applications Doctoral Training Centre (DTC) in the United Kingdom, so I know a fair amount about it. By trade I am a autonomous control engineer, specialising in unmanned aerial vehicles (UAVs).

Given all the problems outlined above, even the suggestion of putting a fuel cell on a small UAV, which is essentially a modified off the shelf remote controlled hobby plane, seems crazy. But it is do-able, and has been done. The advantages for flight aren't the clean & green approach currently dominating the selling point of fuel cells, but that key word "endurance". To fly for 10 hours, a UAV would have too many batteries to float, let alone fly, but with hydrogen's energy density this may well be possible. That's what I'm going to find out.

 

4. So that's nearly 500 words with no raspberryPi?

 

Haha, hopefully I have set the scene now. Let's talk about the electronics!

The fuel cell is a dumb system. It's just a contained and continuous chemical reaction. But it can be controlled through the hydrogen supply, the load and the temperature. I can overcome the poor transient performance if I know that "soon" I will need full power; I can simply crank the fuel cell up, dump the excess power, then when the time comes, 100% is there to give. Sounds wasteful, but it turns this fuel cell into something useful. To control the logic we need a computer. On a small UAV the raspberryPi is ideal, in terms of size, power (in & out), flexibility and functionality.

Running a Real Time Operating System (RTOS) is a seriously useful tool, which I could not do on my work last year (using Arduino). I can programme in any language, use other peoples software (eg the camera) and share my code with the world (and myself for backup!) on GitHub.

So far I am using several add-ons including the MATLAB/SIMULINK support (to help the academics!), rPi Camera, delta-sigma-pi I2C ADC, piFace SPI Digital IO, TMP102 I2C temperature sensors and have the whole lot connected to an onboard UAV autopilot.

 

At risk of making this essay any longer, I'll wrap up now. I hope this is something that tickles your interest, and keep tuned for some videos, pictures tutorials and demos in the coming weeks. In the meantime, if you are interested in the plane the check out my page on diydrones.

 

Simon

_________________________________

S HOWROYD MEng (Hons) RAFVR(T)

Academic Researcher

Fuel Cells in Unmanned Vehicles

Autonomous Systems Specialist

Aeronautical & Automotive Engineering

Loughborough University

 

GOPR0017.JPG

Filter Blog

By date: By tag: