ARDUINO PROJECTS
UPDATE: Images auto-refresh after 30 seconds.
Four. Users Online Counter
24 June 2010
This shows the number of users online at the moment. It's very rough, the counter itself counts as a few users (about 18 of them. Oops) but I'll sort that and add the hitcounter to it tomorrow.
Three. Physical Hit Counter
26 May 2010
This counter clocks on one whenever this page gets a hit. The image on the right is a webcam grab which updates every 30 seconds.
Turns out the image quality is crap, it's quite often distorted. Sorry about that.
LAG: It takes about seven seconds per hit cycle. If this place is getting a lot of hits there will be a lag between the hits gained and the hits on the hit counter (as you can see by the two numbers on the right).
Kit is an arduino, ethernet shield, servo, five digit counter and a bit of Meccano to hold it all together.
Physically it's very simple. When a hit is registered the servo twists 180° and back, which pulls the lever on the counter. I ordered the counter from China a couple of weeks ago, it arrived the other day so I made this.
The software is in two parts. Firstly, my web server needs to keep a track of hits.
For some reason, I've ended up with a complex system which involves a webserver on my local network which keeps a tally of the local counter. Every time the page is accessed it checks the local tally against the site in question's tally. If they differ it returns a "Y" and adds one to the local tally, otherwise it returns "N".
The arduino software is pretty simple. It polls the local counter page, if it gets a "Y" it moves the servo, then waits a second before starting again. If it gets a "N" it waits a minute before checking again.
The arduino code is available here: link
If you have any quesitons or comments please leave them on the ardiuno.cc message board here: link.
Two b. Twitter Spooler UPDATE
15 May 2010
I have made some minor adjustments to my Twitter feeder.
I swapped to a bigger screen, a 4x20 LCD which shows the type of feed, tweeter, time of tweet, the tweet itself and the hit count of this web site.
I added a potentiometer so you can change feed - to show the latest tweet from your friends feed, your feed or the most recent mention of you (@you). The map function didn't seem to evenly reduce the range down to three so I used an if statement to define the range, which then adds a GET type PHP variable to the URL called.
I've added a counter to this page. It's increments a number stored in mysql, and the page that generates the feed tags it on. Due to the way I wrote the arduino app I put it first. If I put it after the tweet it wouldn't show til the tweet had scrolled off screen.
I'll list the code and stuff once I've put it in a box.
Two. Twitter Spooler
11 May 2010
An LCD screen shows the latest tweet from my friends' list. Requires: ethernet shield, LCD screen (LCD library compatible), web server (for sorting the tweet out).
Web Server
The web server uses the twitter API to grab the latest tweet and list it in a convenient format for the arduino to grab. I used twit.lib.php (here) and the following code to output two lines, separated by a linebreak. First line is 11 characters of tweeter's name and the time the tweet was posted. Second line is the tweet. Download code here.
You need to know the IP path to your web page (rather than using the domain name). If you're on shared hosting you might need to ask your ISP for it. I hosted it on a web server at home.
The LCD
The wiring is as standard, but pins 11 and 12 have been shifted to 7 and 8 as the ethernet shield uses 11 and 12.
The Programme
I utilise the ethernet library and LCD library which come with the arduino, and PString which allows you to print to a string in a similar way to printing to the LCD (here).
The main problem I had was overflow of the LCD - if you send a 140 character string to the LCD it'll wrap round onto other lines. I print 16 characters of the tweet to the LCD at a time, shifting the starting character so it scrolls the tweet. Anyway, here's the code: Download code here.
Comments? See the relevant post on the Arduino.cc messageboard: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1273616992
One. Laser Triggered Flash
2 May 2010
I ordered an arduino starter kit (this one) which arrived yesterday, which came with a number of projects to get you used to the various components it came with and how to programme the thing. After a morning's worth of play I decided to build a laser-triggered flash gun for doing a bit of high-speed photography, the idea being that the flash would fire when a laser beam is broken, meaning I could capture something breaking or dropping into water.
The basic idea was to monitor a photoresistor and then trip the flash using a transistor. I picked up a cheap laserpen for a couple of quid, and realised I could use the arduino to power it.
I removed most of the shaft of the laserpen in order to bypass the button, though this connection and the connection to the flash gun were both crap, so I had to go get a few crocodile clip ends. These worked well for the laser but are still a little delicate on the flash gun as the points are rather small.
The flash triggering was a little tempramental. It would fire when not triggered and not always fire when triggered, so I switched the transistor for a relay and this sorted the problem, and also added a nice clunk which turned out handy for testing.
I also added a couple of buttons, one for stop and one for start. The laser is off when in stop mode (to save on power), pressing start fires the laser and (after a short moment, I wasn't sure if the laser took any time to warm up) the photoresistor is monitored for a drop in light level. Once the flash has fired it goes back into stop mode. There's a red and a green LED too, to indicate status.
It worked! The trouble I had was with the composition of the shot and keeping the laser and photoresistor in place.
I picked up a cutlery tray for a couple of quid as it has several separate sections and some thick raised edging, meaning I had a place to put the sensor and laser, a place for the arduino and breadboard and could flood one section. This worked well, though the laser and sensor have a habit of slipping out of place. The other problem was dropping the object in the right place to trigger the beam. It's quit tricky dropping something through an invisible bean in the dark.
Code:
I'll pick up some black material in order to make a decent stage for the shoot, as well as using a bit of mecanno to make a frame to house the laser and sensor as well as a drop-zone over the top.
Next version:
* The buttons will be a go/stop toggle and one to fire the laser, to check aligment without firing the flash.
* When go is pressed the light level will be measured and used as a base, so deviation from that approximate light level will trigger the flash rather than the rather arbritrary value it currently uses. This should make it more sensitive.
* I'll be wiring it up on a strip board and putting it in a project box so I can pop the arduino in when I want to use it again. I've picked up some 2.5mm mono plugs and sockets in order to have the flash, laser and sensor plug in easily.
Comments? See the relevant post on the Arduino.cc messageboard: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1272850113
Update
I've tweaked the setup a little (will write up what I changed later):

Click for big

