Twitter LED (Broken/Being repaired)

Note: Before you start this article take note that the LED lighting code and word recognition should still work but twitter have made it so you can’t access tweets this way anymore. You have to sign up to be a developer and insert authentication code. I am trying to currently repair this but twitter aren’t making it easy ūüėõ

For future projects and general usefulness I have decided to try to learn a new programming language. I have decided to try python for two good reasons, because it is a good language to program projects with the Raspberry Pi and because a large chunk of my course next year is programming simulations in python.

For my first program I’m going to do a twitter feed controlled LED, I also plan to incorporate twitter into a later project so this is a good starting point.

Ingredients list: A Raspberry Pi, an LED, a 220 Ohm resistor, Internet access and a Twitter account.

First take an LED and a 220 Ohm resistor and connect the resistor to the cathode of the LED. Then connect the anode of the LED to pin 7 of the GPIO pins on the Raspberry Pi and the resistor to pin 25 using two female to female jumper wires. A GPIO pin layout diagram can be found here. Once you are sure this is done correctly, a mistake could damage the Pi, boot up your Raspberry Pi ( I am using Raspbian Wheezy). This is all the hardware setup.

prLED

Now to install the appropriate libraries type this into the command line:

wget https://raw.github.com/Rob-Bishop/RaspberryPiRecipes/master/InstallTweetLEDLibraries.sh

Now run the installer by typing sudo: sh InstallTweetLEDLibraries.sh

Okay you know have the appropriate library the next step is to create the file. I’m using nano, to make he file type this command:

nano TweetLED.py

In the editor you just opened type the following code, quick tip press CTRL X to save and exit the editor. Note, I am going to put ; at the end of each line to make the program clearer do not put these into your program.

import urllib ;

import simplejson ;

import time ;

import RPi.GPIO as GPIO ;

;

GPIO.cleanup() ;

GPIO.setmode(GPIO.BOARD) ;

GPIO.setup(7,GPIO.OUT) ;

;

def latest_tweet(twitter_handle): ;

twitter_results = urllib.urlopen(‘http://’+’search.twitter.com/search.json?q=’+twitter_handle) ;

result_list = simplejson.loads(twitter_results.read()) ;

return result_list[‘results’][0][‘text’] ;

;

count = 1 ;

;

while count > 0: ;

tweet=latest_tweet(‘@JamesLeftley’) ;

;

if ‘on’ in tweet: ;

print tweet,’ – LED ON’,’\n’ ;

GPIO.output(7,GPIO.HIGH) ;

;

if ‘off’ in tweet: ;

print tweet,’ – LED OFF’,’\n’ ;

GPIO.output(7,GPIO.LOW) ;

;

if ‘stop’ in tweet: ;

print tweet,’ – Stopped’,’\n’ ;

GPIO.output(7,GPIO.LOW) ;

count = 0 ;

;

time.sleep(2) ;

Now save and exit using CTRL X and you should be taken back to the command line. To run the program type:

sudo python TweetLED.py

To stop the program tweet stop, to turn the LED on tweet on and to turn the LED off tweet off. The tweets can say anything as long as they include the twitter handle, in this case @JamesLeftley, and the command. All the commands are case sensitive.

To personalise the program change the twitter handle, add more outputs and change the commands.

London Arduino

Tonight was my first time along at the London Arduino Meet Up.
The London Arduino Group is of a similar idea to the Raspberry Pi Jam events that I’ve been to
before. It is a group of people who want to share knowledge about the Arduino platform and start to
innovate across other platforms.

This month we had presentations including hobby electronics, internet controlled LED’s and 3D
printing.

Using an Ethernet shield, Christian, put together a set up where he was able to control the status
of an LED in his web browser. This was done on a local network (sorry guys who wanted to take
control of his little light) where he showed two methods of flicking the switch.
The first method he showed off was to use the arduino as a web server and construct the html on it
as well. Then it was a simple matter of connecting to the IP address that was defined on the
arduino and hey-presto it worked.
The second method that he demonstrated was a little more complicated involving node.JS, sockets and other technical jargon that I didn’t catch.

On a similar vein we had Liam demonstrating the use of a TP-Link Wireless N Nano Router (TL-WR702N) to connect an arduino to the internet. He argued that the use of WiFi shields is overly complicated compared to Ethernet shields, as well as being a lot more expensive  So if you are willing to have a slightly bigger package then you can connect the Ethernet shield to the nano router and leave that to sort out the complicated subtleties of wireless connections, allowing you to get on with innovating your wireless solution. Another thought is that a nano router is much more versatile than a WiFi shield because it can be plugged into a computer, games console, Raspberry Pi, or any other device that has an Ethernet socket.

In the realm of Hobby Electronics we had Danny, who was plugging his first ever kit robot. Orionrobots.co.uk is his creation and is where he is selling his first his own starter kit robot. In this kit you will find everything that you need to to construct a small chassis with 4 wheels controlled in pairs (left and right) by a L298n dual H-Bridge controller board which is interfaced to an Arduino Uno R3 (provided in the kit). With a easy fit design, you only need a screwdriver to put this kit together making it perfect for anyone who is; unsure with tools, in need for a robot chassis quickly, or just lazy.

The final talk of the evening was from Mark, on behalf of another London Tech Meet-up group, Future Manufacturing, who have a keen interest in 3D printing. They are really keen to see cross¬†collaboration between our two groups on various projects including potentially the Luma Module Interactive Spaceship. The Luma Module is a KickStarter project where they want to build a spaceship that lights up when people interacts with it. This spaceship will then be shipped (no it won’t fly itself) to Nevada for the Burning Man art Festival at the end of August 2013.

Troubleshooting

So far I have built the cloud chamber and have moved on to testing. It came as no¬†surprise¬†that it didn’t work first time and the problem is¬†obvious, cooling. The¬†heat sink¬†I am using is not up to the job of cooling the¬†Peltier¬†coolers, again¬†no¬†surprise¬†as it is about 6 years old.

I attempted to solve this with more fans.

WP_20130427_002[1]

The heat sink still reaches about 40 degrees which is about 10 degrees to much, the next step will be to clean the 6 years worth of dust from it and if that fails a new(er) heat sink may be in order.

Progress Update

Previous Post

So finally enough of my parts arrived to start building ūüôā

WP_20130317_001[1]

So far I have:

An old cpu fan, a 500ml pot, thermal paste, a TEC1-12710 cooler, a TEC1-12709 cooler, an old ATX power supply (450W), glue, a knife, some metal, some uranium glass, a torch, scissors, nuts and bolts.

If you are interested in building this project yourself I would recommend waiting until I have it working properly. ūüôā

This first part is the same as the the first part of the Instructables link in my first post and has been proven to work.

To start off I measured out a hole for the 12709 in the base of the pot, the coolers are 4cm by 4cm, and put it to one side. Next I cleaned and put thermal paste on the cpu fans heat sink.

Cpu heatsink

The paste should form a complete layer as thin as possible on the heat sink. The cooling is by far the most important and difficult part of this project and is very prone to going wrong. Place the 12710 cooler on top of the thermal paste, with the heat sink orientated as in the picture and the 12710 cooler on top with the wires towards you the red wire should be on the right.

A quick check is now needed, make sure the PSU is unplugged. On the main power connector connect the green cable to one of many black cables, this is the PS on connection and will allow the power supply to fun whilst not connected to a PC.  Plug the CPU red cable to a yellow cable, all yellow cables on all of the plugs are 12V, and connect the black to a black. The same goes for the 12710 cooler, red to yellow, black to black. A useful page http://www.smpspowersupply.com/connectors-pinouts.html

Pin layout

This next part must be done quickly, place a finger on top of the 12710 cooler and plug the power supply in. Make sure air can flow through the fan and turn it on.

If the fan doesn’t spin turn it off and check your¬†wiring, if it still fails to spin unplug the 12710 cooler and use a multimeter to check if there is a voltage being produced by the power supply, if there isn’t make sure the green and black are connected. If there is still nothing then your PSU may be broken check the fuse first though.

If the 12710 cooler gets hot switch it off quick, it is upside down. If it gets noticeably cold then it is set up correctly, turn it off.

Place thermal paste on top of the 12710 cooler same as before as thinly as possible and place the 12709 on top. Both should be orientated the same way, wire colours on the same sides. Now for a check, the set up is the same as before apart from the red wire from the 12709 goes to a red wire in the socket (5V). The cooler should get very cold, around -25 degrees Celsius or better.

Up to this point is the basis of the cloud chamber, from now on this is all experimental and has a high chance of not working properly. Again it is advisable to wait until I have it working before making it yourself.

At this point I went back to my pot, on all the cloud chambers I have seen the dry ice or other coolant is connected to the plastic. This didn’t seem very efficient¬†so I cut a hole in the plastic and mounted it on the cooler.

WP_20130317_003[1]

I used the glue to keep it sealed.

Following this I made sure pressure was applied and the whole thing couldn’t twist by using some nuts and bolts and I fixed a plate, using thermal paste, to the top cooler to give it a larger surface area.

WP_20130318_005[1]

I switched it all on for a test and found that water in the atmosphere condensed and froze on the metal plate, I took it as a¬†successful¬†test ūüėõ

Until my Isopropyl¬†alcohol¬†and thermometer arrives I can’t test it any further.

Digibury Discussions

So the other day, for the first time, I went along to Digibury, a event for people interested in technology in the local area. At the monthly meetings you can normally expect to 3 different talks.

The Digibury Postcard

The Digibury Postcard (Slightly crumpled)

At this months meeting we heard from¬†Joe Webb, a PhD researcher in Cultural Studies. He is conducting an ethnograph about how “computing professionals” have learnt to use computers. He has started to see some very interesting generational differences in how people learnt to use the computers.

Next up on the schedule was a talk from Deri Jones, from SciVisum.
At SciVisum they¬†specialise¬†in load testing websites and web applications. From the data that they collect and analyse they can advise a business’s technical team so that they can adjust the companies website to be more efficient and capable of coping with the expected load. It also means that SciVisum can advise the less technical directors as to if there is a something that the companies technical team can do when their website has a fault.

The final talk of the night was from Chris Atherton, a user experience architect. She was talking to us about the recognition rules that humans apply to the world around them, for example that a chair has 4 legs and a back, or that a wheel is circular and has spokes. She then asked that we apply these rules to showers and to microwaves, and we all came to realise that these products do not have any standard user interface. Eventually after some discussion we even decided that showers do not offer enough control for the temperature of the water, only cold or hot, whereas microwaves offer too much functionality above and beyond heating a dish for a set amount of time.

All in all I really enjoyed the evening of talks, and am looking forward to next months set of talks on interfaces.

Peltier Coolers

A Peltier cooler is a small device that is usually put in between a CPU and its heat sink. This is because a Peltier cooler is far more efficient at cooling a CPU down than a heat sink alone. The tec1-12710 and 12709 that where mentioned on my previous post are almost identical except that the 12709 is a lower power than the 12710.

The Peltier coolers are named after the  Peltier effect, a product of the thermoelectric effect. I am not going to go  into detail about either but I will give a brief explanation of how the cooler works. When a temperature gradient is applied to a thermoelectric device a voltage is created. As is often the case in physics what works one way also works in reverse. When a voltage is applied to a thermoelectric device a temperature gradient is created causing one side to be cold and the other hot.

from http://www.laserfocusworld.com/articles/print/volume-43/issue-8/features/cmos-detectors-thin-film-tecs-give-new-life-to-cmos-cooling.html

This is the¬†basic¬†overview of how a¬†Peltier¬†cooler functions. I hope this proves useful ūüôā

So You’ve got yourself a Lilypad?

So as part of my involvement with TinkerSoc, we now have our new hoodies. These hoodies are designed so that a Lilypad Arduino can be sewn onto it and then components added to it. We will be wearing hoodies that we can literally tinker with.

Lilypad Arduino

For those that don’t know, the Arduino Lilypad is an Arduino development platform intended for clothing and e-textiles. Using conductive thread you can sew tracks and components onto any fabric and then programmed.
The Lilypad doesn’t have a USB plug like an ordinary Arduino Uno. This is because the Lilypad does not have a FTDI Chip (Future Technology Devices International Ltd) unlike the Uno and many other Arduino’s. The FTDI chip converts the USB to serial communication.

LilyPad Programming_bb

So because the Lilypad doesn’t have a USB connection we can use an Arduino Uno instead. To do this we need to remove the ATMega 328p from the Arduino Uno, then break out the header on the Lilypad. As per the diagram above from left to right, the pins connect to Gnd, Gnd, 5v, Rx, Tx and Reset. With these connections made, we can proceed to connect the Uno to a computer, and then start up the Arduino IDE. While in the IDE, make sure you change the board to the correct version of the Lilypad you are using. (If in doubt try to read the number on the¬†Microcontroller¬†on the¬†centre¬†of the board)

Arduino IDE
And with that done you are ready to start programming, I suggest loading up the example blink program first. Enjoy.

The Cloud Chamber

I am taking my inspiration from this project here http://www.instructables.com/id/Make-a-Cloud-Chamber-using-Peltier-Coolers/. I plan to start by making a few choice modifications to the design. Once I have it up and running then I will make more drastic changes to the project to see what gives the best result.

First off is some basic concepts on how cloud chambers work. There are three main types of radiation alpha, beta and gamma. The two types we are focusing on is the alpha and beta, this is because these are heavily ionising. The alpha particle has the greatest charge and therefore the greatest ionising power, followed by the beta particle with half the charge of the alpha particle. The ionising properties of the radiation is what allows the cloud chamber to work.

Inside the cloud chamber we create a supersaturated vapour of alcohol by cooling evaporated alcohol down to very low temperatures. This is usually achieved with a chamber of dry ice at the base. As a charged particle, like a Helium nucleus (alpha particle) or electron (beta radiation), passes through the vapour at high speeds it ionises the vapour around it leaving a trail. These are the white lines in the image on the link at the start.

Unlike most cloud chambers I’m using Peltier coolers like the one in the link to cool the alcohol. The advantage of this being that you don’t need dry ice every time you want to run your cloud chamber. So I start off with a rather odd shopping list:

A Tec1-12710, A Tec1-12709, Thermal paste, A CPU fan (bigger the better), A clear plastic pot, Some thin scrap metal, Concentrated alcohol (Isopropyl or similar), Some bolts and screws, A light source (a torch to start with), A computer PSU (above 300W) and a radioactive source.

While a radioactive source is not¬†necessary, as you can detect cosmic rays,¬†I thought I would get one for testing. My source is some uranium glass from¬†eBay¬†although others are available this is a nice alpha source, some fire alarms contain americium which is a strong alpha source and can be used. WARNING! handle with care! Although these sources are rarely dangerous ingesting or¬†mishandling¬†a radioactive source is never a good idea, swallowing glass isn’t the best idea even if it isn’t¬†radioactive. ¬†If swallowed consult a doctor¬†immediately, better safe than sorry.

Almost all the things on the list can be found on eBay or in a dump. If your a student it is worth asking around your labs for parts. Fortunately I have most of the parts from old computers and bits lying around. The rest I managed to obtain for £20 including delivery.

If you want to build this yourself  it may be worth waiting until I have a working product before you buy all the parts as I am making this up as I go. I will also add more detailed part lists as I go.

Tools: Aside from the essential tools (screw driver, hammer, duct tape, etc.)  it is probably useful to have a multimeter and a inferred thermometer although they are not essential.

Okay, after that lengthy post I look forward to starting the project as soon as I receive my parts in about a weeks time!

Joining the fun

I’m half way through my 1st year studying physics and all is well. My goal is to do a masters in Physics with Particle Physics and move straight to a Doctorate in the subject. If all goes to plan my 4th year will be spent in Geneva doing my masters year at the LHC.

Recently I have been granted access to the masters student workshop and I am taking this¬†opportunity¬†to build some projects of mine so you can expect a new project to be started in a few weeks.¬†Unfortunately¬†I won’t have the materials I need to start until the 16th of March but there is plenty to do before then!

My first project is to be a budget DIY cloud chamber to detect radiation either due to cosmic rays or a radioactive source.

If there is a project you think would be¬†interesting¬†to¬†build¬†for a low budget I am happy to hear your ideas ūüôā