modified: Sunday 24 November 2019
Archives: Robots and lab projects pre-2016
The pretty robots are further down the page. Scroll down!
Everyone starts somewhere
One of my first projects with a 34063 based boost converter and my own discrete H-bridge was this 'spoonbot'. The whole robot ran off two 18650 cells in parallel (2.8 to 4.2V).
Here is an early photo before I finished the H-bridge:
Skates are very useful in small robots. They're much simpler than basically anything else and work fine until you get to high speeds.
This rail-riding robot didn't work. Motors span too fast, didn't have enough torque:
First serious contenders
UNSW runs a competition called Robocup Junior. There are a few competitions and in my final year of high-school I decided to try and compete in one.
Traditionally many teams use lego-mindstorms based creations. This route was (and probably still is) very expensive -- a single IR sensor cost upwards of 50 AUD. Worst of all the proprietary IDE you had to use to program the Mindstorms bricks cost money had a blurry font you could not change. Brrr.
I wanted to show that a viable robot could be made cheaply and effectively using non-lego parts. I think I succeeded in this part of my goals, however I never actually finished the robot or competed in the comp.
The two styrofoam wheels were attached to servos. They were designed to lift an aluminium drink can. Underneath these was a HC-SR04 ultrasonic distance sensor.
You may be able to guess where the name of the robot came from.
Underneath Forkbot we can see the drivetrain, battery holder and a sensor board:
I ran this robot on two 18650 cells. You'll soon learn I have a fascination with everything lithium.
The gear boxes I swindled off a teacher required some dark-arts to function properly. Do not stare directly at the gearbox housings for extended periods of time unless your eyesight is already damaged.
The orange sensor board was quite interesting. It had an array of ten IR photosensors (black) and 5 IR LEDs (white) that you can see in the photo above. I used these to sense and follow a black line. The competition lines looked a lot like black electrical tape put down onto a surface of white foamboard, but they also had green sections you had to detect at corners and specific parts of the track.
Here is what the other side of the sensor board looked like:
I used a 4051 8->1 analog multiplexer to allow me to sample the ten LEDs on an Arduino Uno which only had 6 analog inputs. A tiny black sot23 SMD transistor hides on the left side of the board above to turn the LEDs on and off.
This robot looked a lot less glorious from behind:
A tentacle mess of cables went everywhere. The rearmost board originally had a switch on it, but that exploded into parts and had to be bypassed. In the end all the rear board did was harbour a pair of large NPN transistors for driving the two motors (in a single direction).
Debugging, programming and calibrating this robot was fun. At one point the robot was randomly resetting: it turned out the protection circuits I had stuck to my 18650 cells was kicking in when the motors turned on. All of the sensors on the bottom board reported vastly different readings on the same surface so I hand-calibrated them on light and dark surfaces, then programmed in my calibration coefficients.
More recent robots
Part of a groupwork uni project. Self explanatory. Copious 18650s.
I had to throw together a mosfet driver for the drill motor as it sucked something in the range of 10 to 20 amps when under load. For a bit of fun I rear-mounted an SMD led and diffused its light with a blob of hot-glue. Every product should have a power-LED!
UGV impromptu motor driver(v1)
The 'unmanned ground vehicle', a project by my student group CREATE. It's a large steel-framed robot with mechanics and electronics from an electric wheelchair. The motors ran at 24V and sucked something around 6 or so amps on average.
Since taking this picture the UGV has gained a fresh coat of paint, new goals and an entirely new control system. I have not been involved very much in the recent changes so I don't have any better photos.
Right before the start of 2015 we blew up the motor driver that came with the wheelchair. I threw together a replacement over a weekend with the parts I could scrounge from my student group's collection and my own shelves. We wanted to have it ready to show off during the introductory week ('o-week') for that year at UNSW.
Each motor was controlled bidirectionally by a pair of relays. Each pair of relays made a full H-bridge. A fifth relay was used to switch on and off the brakes built into the motor gearboxes.
This relay board was controlled by an 'intermediate' board, containing a 5V power supply and transistors to drive the relays:
Finally an ethernet cable connected this middle board to a hand-held controller. The controller had four buttons for motor control (backward and forward for left and right motors). The inside of the controller looked like this:
This is one 'half' of the remote. Another green piece of vero-board had female headers on it so that it could slot directly onto this one, protecting all of the delicate wiring from fumbly fingers.
It's worth mentioning that ethernet cable was used because it's a convenient way of wiring things when you need lots (almost 8) wires. It comes in many lengths, has easy snap fittings, is cheap and easily available. I scrounged the two receptacles from some old laptops I had lying around in my room.
Underneath the main and intermediate boards was a small forest of wiring:
To obtain variable motor speeds you had to hand-pwm the motors by rapidly pressing the tactile buttons on the remote. The el-cheapo relays did not enjoy this and eventually one welded itself shut. Inspection revealed that the manufacturer used solder in their relay contacts. This solder had melted and fused the relay closed.
This driver board had very harsh electronic-braking when you let go of buttons on the remote. A few people where gently flung from the robot whilst trying to ride it.
This is the best part of the page for photo-gawking.
I found a plastic toy car chassis in a local council cleanup. It was just a frame, rear wheels, gear-reduction and a motor; nothing else. No steering mechanism or electronics. No front wheels.
I decided to revive this car as a test platform for several of my ideas at the time.
Where do I start?
Front wheels and steering
I originally made some wheel mounts out of small pine blocks, however these turned out to be too soft and screws became wobbly in them. In the end I cut, drilled and tapped out some better mounting blocks from aluminium:
The wheel itself slides onto a 'shaft' made out of a large decking screw. These are extremely hard and were able to cut their own thread into the mounting blocks.
You may also notice white PVC plastic making/covering a mounting point on the chassis: one of many repairs.
I originally held the wheels onto their shafts using big dollops of hot glue, however this stuck poorly to the (teflon?) coated surface of the deck-screws and the car would lose wheels going around corners. In the end I machined some more aluminium parts to secure them:
The yellow wheels themselves are cheap plastic ones sold by my student group.
Chassis and power
The original black ABS chassis was not designed for the speeds I made this car run at. It has suffered many fractures and repairs during my evil reign:
Even driving gently into things would snap parts of the frame. The kitchen sponge I attached at the front helped a lot in reducing crash damage, but it was imperfect and bigger would have been better.
I converted them battery compartment to house 18650s. Four lithium cobalt cells lie in series to run the car at about 16.8V (when fully charged).
The grey plastic dividers you see were originally the lid of a flatbed scanner I picked up. A flat piece of ABS plastic is a flat piece of ABS plastic nomatter where it comes from. It felt a swift end by the teeth of my bandsaw.
I also made a cover for the battery compartment:
Two tounges on the cover slid into the body and a single large-washered screw was inserted into the body to stop the cover from unhinging. On the other side of the cover was a piece of bubble-wrap to keep a gently pressure on the batteries.
Note the green ribbon. Extracting these cells without one is a nightmare. You can't (easily) use a screwdriver to lever 18650 cells out of their holders as the insulation on these cells tends to be thin, so you end up shorting the terminals and spraying sparks (not fun!). Battery extraction ribbons work amazingly well.
Some bench tests showed that I was heavily abusing my 18650s. From a fresh voltage of about 16V the batteries would drop to about 9V (at the terminals!) when I gunned the throttle. That was particularly fun to find out. It also explained why the performance of the car deteriorated after only a few charges :P Originally the car could outrun me sprinting, however it's much more sluggish now. Not to mention my 18650s are about 5 years old anyway.
Suicidal motor driver
I designed and made the motor driver on this car as a prototype for the second motor driver I ended up making for the UGV project (covered later on this page).
Here is a close-up of the final product:
I used a hybrid relay + fet architecture. The two heatsinks housed a couple of N channel mosfets that acted as the lower legs of the H-bridge. The upper side was controlled by the blue relay. This allowed me to avoid having to drive hide-side mosfets whilst still letting me PWM the motor power. The relay only ever had to click when you switched from forward to reverse and I coded a little dead zone in the throttle so that it would not repeatedly click when the control stick hovered around 0.
Some various design notes:
* The plastic divider between the heatsinks was to stop them touching. Each heatsink was an output terminal for the motor.
* The large white resistor was for current measurement, however I never used the readings.
* In the lower left were a couple of voltage regulators: a 12V one for driving the mosfets and a 5V one for driving the relay. Although I could have gotten away without either, they would be necessary in the UGV version of this board.
I nicknamed this board the 'suicidal motor driver' as I omitted several key 'safety' components from its design to make it simpler. If you didn't immediately bring the two control wires to high (5V) on power-on then the motor driver would short out, for example. Arduino's boot with their digital pins setup as 'inputs' (floating), so a simple pull-up resistor avoided problems. Woe be to anyone who accidentally disconnected the ground wire from the Arduino, however. Or any wire from the motor controller in general.
Here are a couple of shots taken during construction. I etch using vinegar, salt and hydrogen peroxide. This particular board came out very nicely:
Years ago my father crashed a small hobby aeroplane. I repurposed the controller for this car:
The 7-segment display simply measures the battery voltage for the remote. 9V batteries drained very quickly causing me to lose contact with the car.
Note the piece of cardboard on the right joystick's trim adjustment. This added a bit more friction to the trim control. At one point I destroyed the pot built into the right stick and my replacement pot had a lot more turning friction. The cardboard stopped the trim control zipping left or right whenever you moved the main stick quickly.
The original pot had an extra long shaft. I had to adapt one of my pots to fit:
Inside the remote we can see an Arduino and an el-cheapo 433mHz transmitter board:
My transmission scheme was to just shove serial data at the (amplitude modulated?) transmitter. It worked for about 20m of range, provided I had the right length antennas and a fully charged 9V in the remote.
The remote constantly transmitted the positions of its two sticks in a 'message' with a checksum at the end. The car would cut throttle and beep if it did not receive a valid message within a few hundred milliseconds.
Exact readings from the potentiometers would vary from one use to another and I didn't want to hard-code in their maximum values. I programmed the remote wait for you to press each of the sticks to their maximum positions before it started transmitting.
The remote also had some other comfort features such as a dead-zone for the sticks.
- The pencils attached to the frame are stands for when the card is upside-down.
- Hot glue and toothpicks are now an official mounting strategem for Hales industries
- Most of the parts for this robot were scrounged or stolen. Although this meaned it cost me almost nothing to make, it also meant that parts like the Arduinos were stolen from it afterward.
"Time for something bigger and better!". More motor driver madness.
(read the sections 'Caro' and 'UGV impromptu' above for some background)
As a reminder: this H-bridge architecture uses a relay as a high-side switch and a pair of mosfets as the low-side switches.
PCB and circuit design
I designed this board using Kicad and etched it myself. I use a toner transfer technique:
Of all the home-etching you see on this page this is the worst example. You can see pitting everywhere in the copper and I had to fix a few broken tracks.
Notation for the component-side of the board was also done using toner-transfer. The lettering and drawings were not indestructible but held on decently well once the toner cooled down:
Component and trace layout was a mixed bag.
The high-power components were laid out well. I started by placing these components first and re-designed their layout several times over before I was happy. The larger aluminium heatsinks acted as important electrical links allowing me to cut down on a few heavy-gauge jumper wires.
The design of the logic and control circuitry was done last and ended up being a complete mess. An ATMEGA328 controlled everything and a TL074CN opamp was abused as a level shifter to driver the low-side FETs. Too much was shoved into a tiny space on a single-sided board and I had to hack in many jumper wires:
You will see a few pull-down resistors and diodes around the place. I hadn't thought of how the board would behave when supplied with battery (24V) power but not logic power. These parts made it behave in this situation.
I only briefly had the board hooked up to the UGV to test before I went overseas last year. The motor driver was not happy with my departure:
Look closely at the long DIP chip slot. There once dwelt at ATMEGA328.
Originally I also had nice brass spade-connector tags attached to each of the four thick heatsinks. The heatsinks acted as terminals for the motors. You would plug female spade connectors directly onto these. Unfortunately some thief nicked them and left the fets unscrewed:
I get the last laugh, however. Those screws are T10 torx head and you can't get in to unscrew the middle two. Suckers probably had to use pliers.
I'm sure many people are wondering why I wanted to put an ATMEGA328 (or any form of micro) in my design. Next time I won't. I wanted to make sure that the fets were turned off for a 'dead time' whlist the relays were switching to avoid arc damage to their contacts. Next time I think I'll implement an analog/discrete circuit to do this instead.
I'd love to control these boards using a programming logic device such as a PLD, CPLD, GAL or PAL. Whilst some of these chips are very cheap and come in DIP packages, their programmers cost in the range of a hundred dollars or more. AVR micros on the other hand are more expensive (a few $ per chip) but come with a completely free, open-source and easy-to-use toolchain. I used a cheap knockoff Arduino as my ISP programmer:
An advantage of using passive logic over a micro is that you can easily design the circuit to accept simple PWM'd signals as inputs. I didn't go this route, instead employing a complex checksummed serial communication system (similar to Caro's remote). The ATMEGA on the motor driver then generated the PWM'd control signals for the FETs.
Some time in the future I'll make another motor driver. I really like the simplicity of having a relay as a high-side switch and I'll probably carry this design feature over, but the logic/control system needs a rethink.
Miscellaneous projects and photos
Here is a small selection of photos I came across whilst looking for things to put in the sections above. I have a lot of photos -- tell me if you find these interesting and want me to scrounge through and find more.
Replacing batteries in digital cameras
Does your old camera use a custom-size li-ion battery? Do modern replacements cost a lot or have little capacity because they have been on shelves for as long as your camera has?
Do not fear, 18650's are here!
Warning: do not use at airports.
Charging paralleled 18650s
Easy as cake.
Dangers of AA batteries
Just because Li-Ion batteries look like a nuclear arsenal compared to traditional store-bought batteries, you should NOT assume that ordinary batteries are 'safe'.
I had a 4xAA battery holder sitting on a shelf above my bed at one point. It sat there for a month or so fully populated with batteries and with its leads dangling off to the site. One day I picked it up and noticed something interesting had happened:
Not shown are the slightly molten ends of the black and red leads. Presumably at some point they had shorted and the 6V worth of AA batteries had gotten quite hot:
When I tested the pack with my multi-meter I discovered that the damage had 'disconnected' the batteries from their terminals. It's not fun to think this probably happened whilst I was sleeping.
Charging a lead-acid battery
Ooh this was a while ago. I don't have any of my horde of lead-acids left.
This was a a 6V cell. Charging was regulated by a large NPN transistor (glued to the bat). Voltage was controlled by the long logarithmic slide pot (also glued to the bat). By memory I had to adjust the pot every few minutes.
In the background is an anonymous ATX power supply as the power source.
Alternative watch power sources
Batteries in your watch dead? Can't find the right size replacement? Never fear, AA's are here:
Another item from the 'do not take to airports' and 'not actually practical' collection.
Separating Lipo packs
Common hobbyist li-po packs have a few spiral wound cells in series. From the outside they look like flat slabs in grey or silver plastic bags.
I scrounged some packs with dead cells for free. Often only a single cell has died and the others are still alive. Seperating the cells is difficult, however:
What could go wrong?
The first thing I noticed was a smell. Volatiles had escaped. Oh oh.
No nasty air-battery reactions occurred, possibly because this cell was mostly discharged anyway. Nothing got warm IIRC.
Homemade tools, jigs and processes
I had a large DC motor sitting around for a while that was originally used to start model aeroplane engines. It runs at a relatively low speed but provides a lot of torque (and hence draws a lot of current). Originally designed to run off car batteries (~13.8V) I run it off an ATX power supply.
The headstock is the chuck and bearing off a drill. I connect this to the motor through a small piece of clear plastic tubing. This tubing slips at certain torque levels, which I'll call a feature.
Tailstock is bolted to the base through a slot in the centre of the lathe. The tail-end support for workpieces is a cheap self-tapping screw with the thread ground off the tip.
I only ever finished one thing on this lathe:
I used small sharpened flathead screwdriver as my cutting tool (seen hiding in the lower-right corner of the lathe photo above). Without a tool support the process was slow. I snapped and destroyed the second piece I tried to turn.
Some more photos.
This particular board had tiny (1.27mm) pin spacing with even tinier gaps between copper pads. Without solder-mask I ended up bridging many of the pins to nearby tracks and pads. A cluster-wired disaster:
Sick and tired of counting windings when making transformers? Cassette-tape counters to the rescue!
The counter is hot glued to a stick. The drill chuck connects to the tape counter using an ordinary rubber band.
You will need to take into account that the tape counter wheel and the drill chuck have different radius'. Also make sure to run the drill slowly and gently guide/tension the wire by hand, or you'll just get this:
Parallel port switches
I still have these lying around if anyone wants them.
Optical mouse IC
These things are always very pretty. Who needs zeptobars when you can see the dies with your bare eyes?
Prototype combination lock
I planned to have movable studs friction-fit into the holes so that you could re-program the lock code.
Unfinished. Serious wheel-stability issues as they were held straight by nothing more than the skewer through their centre.
A fun little board that remembers if a switch gets tripped.
Early home-etch attempt. You can see the date on the bottom-left of the PCB:
- Triggering switch gets externally connected to header marked 'SW'
- Triggering switch can either be normally-closed or normally-open (set with invert-normal switch)
- Reset button has a customisable 'delay' so that you can reset it and quickly get out the door without it tripping
- LED only reveals internal latch state when the 'view' button is pressed
- Customisable LED brightness
- Simple analog and digital logic, no micro
- Powered by a CR2032 coin cell
That's it for this post.
I hope you have enjoyed some of my pictures. If you want any more information on anything, please feel free to contact me at via email or leave a comment below.