Needing to hook up lots of LEDs to an Arduino? The obvious choice is to simply hook the LEDs to the digital output pins and away you go. However, this will only give you 14 LEDs.
OR, you can hook one of these fellas. Catchily named "75HC595" - but known as a Shift Register. From just three pins on the Arduino you can drive 8 LEDs! and the fun doesn't stop there... hooking up another one of these puppies to (essentially) the same pins gives you another 8 LEDs :- a total of 16 LEDs off just three pins on the Arduino!! ...I don't know what the limit is but I've seen somebody driving 24 LEDs with three of these chained together. Very cool.
So, here's what I've done so far...
First up - one '595
Next - two '595s — I just ran out of red LEDs!
Lastly - I added a potentiometer to control which LED is lit.
It's a ball and it's pretty darn simple!
Next challenge - experiment with a similar chip... "74HC166" ...which allows eight buttons or switches to be connected to three Arduino pins - and can be chained together also! ;)
At last, I've mustered up the courage to hook up a DC motor to the Arduino!
The reason that it's a big deal is that you can't connect a DC motor directly to the output pins on the Arduino - it'll draw too much current and fry the Arduino chip. This method uses a transistor to switch the large amount of motor current with a small amount of 'control' current. As an added level of safety for the Arduino, I've also use an Opto-Isolator which a means of completely separating the two circuits - control and output. Unless I do something silly (!), the Arduino should be safe. (I already fried one transistor in testing because I'd forgotten to put a diode across the back end of the motor!)
BIG respect and thanks to Mike Cook for his excellent article on hooking up motors.
My circuit diagram is a hacked together version of a couple of his diagrams.
(used with permission - thanks Mike)
The immediate application is for driving the blades on our learning project GRZR - the robot mower!
Mowing the lawn seems like a huge waste of time and energy to me. So, if I can build a machine to cut the grass for me then I'm a happy chappy!
I'm not the first to feel this way. A number of companies have done it already, such as Husqvarna. The problem is, their machines start at about £1,500! They are indeed splendid machines and I'm told that the people who own them would never go back to regular manual mowers.
Such a project is a great opportunity for learning electronics and mechanics and more, so I'm teaching a couple of lads on the back of it. Our first goal has been to make something move under it's own
steam.
The 'brain' is a Seeeduino board (an Arduino clone). We programmed it with some simple moves and powered it with a 9V battery. Two continuous rotation servos do the moving. The whole thing was bodged er.. built on an old CD and held together with blueTack. The fun of prototyping!!
It has no sensing capability at the moment so when it bumps into an obstacle... it.. er.. carries on regardless. The basic moves programmed were: drive forwards, turn ≈90° Left, drive forwards, turn ≈90° Right. Rinse and Repeat.
The nest of wires on the breadboard was for a 5V regulator (thanks Oomlout!) and distributing the power to the servos and the Arduino. This first pic is my trial build the night before. I needed to prove to myself (!) that it would all hang together nicely and actually work. I went to bed with a big smile on my face! :D
Meet John and Harvey, our illustrious team...
And then for fun we strapped ever increasing numbers of felt tip pens to the back and turned it into an ArtBot! The pre-schoolers thought it was marvelous - especially when it ran off the edge of the paper and started drawing on the floor!
See the video... :D
PS. We will consider offers for the final piece of art. Proceeds will go towards our ongoing project.
Addendum
I've just had a fiddle about in the shed with two Stanley blades mounted on a mini CD. The blades are bolted near the edge of the disc and are able to pivot. This is the same approach at the Husqvarna machines - only much smaller. Centrifugal force keeps the blades pointing out while hitting a tough bit of grass or twig flicks them in out of the way. (see subsequent post for video)
I popped a big fat bolt through the centre of the disc and stuck the bolt shaft into my battery drill. !!
Wearing safety glasses (!) and armed with the drill I ran some experiments on the lawn.
Yahoo!! It works. It seems that spinning it faster makes it more resilient to getting bogged down by too much grass. Slower movement across the lawn helps too. Very quickly you can see how the 'grazing' aspect - nibbling the tops off the blades of grass - can achieve a great result. Next step... fit the spinner to a beefed up version of our 'artBot'.