IAN LANG ELECTRONICS
On the right there you can see BOB the Bot and if you've been following the Arduino section you'll remember I used BOB some time ago as a demo for remote control using a pro micro. Subsequently he got stuck in a cupboard for a couple of years and got forgotten about but for this game he is ideal as he has two independently geared motors which are absolutely identical and use very little power. He can't generate the torque that Goliath can but he doesn't need lots of current to get him moving like Goliath does and the latter is what we are looking for here.BOB's in a bit of an unrefined state here - he's engineered using lots of Blu-Tac- but to prove the concept he's well up to the job.
With six volts provided by four of those Duracell AAA batteries you can see up there BOB will scoot over the carpet in natural daylight. Putting your finger on one of the LDRs will cause the linked motor to stop but the other will keep turning and so BOB will turn. Putting your hand between the light and the LDRs causes a slowing of the motors and if one LDR has more shade than the other BOB will turn. Blocking the light entirely will stop him.
How does this work? It's to do with how hard the transistor is conducting. Here's a graph for your consideration:
The graph above is known as the load line of an NPN transistor and this is what it's saying:
Ic is the current that passes through the collector and subsequently to the emitter. Ib is the current entering the base. You can see that the more current entering the base, the more current the collector gets, up to a point. After that point (labelled as B above) it does not matter how much more current you put into the base, you can't get much more current at the collector and indeed it will plateau out and conduct the same current until the point it explodes. On reaching this plateau (C as above) the transistor is said to be in saturation. The gain is expressed as the hFE or Beta and usually for a small transistor in a TO92 package it will be in the region of 100. There are no units as it's a ratio. For example if you applied 0.001A (1mA) at the base you'd get 0.1A (100 mA) at the collector.
In the circuit you may remember that the LDRs are attached to the base. Thus depending on the light they receive, they provide a variable resistance. The voltage remaining the same, the current goes up or down and this alters the current at the collector and thus what passes to the emitter. Remember now that this transistor is in the ground path of the motor and thus acts as a variable resistor limiting the current the motor can carry and thus slowing it down or speeding it up.
Let's do a conclusion to this little project and wrap it up. First of all, the parts:
2 x Light Dependent Resistor.
The ones I used do about 20k in darkness and I got them down to 200 ohms in bright light. Ensure they sit as flat to the board as they can.
2 x NPN transistor
I used 2N3904 types but they do get a bit hot. It's probably better to use something a tad meatier such as a TIP31.
2 x motor
These have to be identical as far as possible and you are probably better off with a pre-made chassis since not only will you get the housings you'll get the motors and gearboxes to fit it too.
To connect the circuit to the motors you will need some sort of connection system since it's rarely a good idea to solder your wires directly in. I used a PCB latch from Maplin. You will also need a switch at the battery end; it does not matter whether in the positive or negative. Use a SPST switch, and mount it on a panel.
For your power supply use four batteries. AAA is good if your space is limited, AA if your space is not so small since they'll last a tad longer.
There's no real practical purpose that you can easily apply what we've made here to (perhaps toys might be an exception) and what we have made physical here is the product of Braitenberg's thought experiment. If you accept that the base level of intelligence is the ability to perceive and react with purpose to external stimuli then BOB, with this circuit, is in fact an artificial intelligence unit of the simplest kind since he percieves light and moves with it and will, when one side is dark and the other light, turn to get back to the light.
You can of course expand this kind of circuit and it need not be light sensors you use. If you use distance sensors, you can make a unit that turns away before crashing. If you use smoke, you make a unit that will travel out of an area where there is a fire and sound a warning. Heat sensors can be used to gauge the radius of a heating system or fire.
If you are a teacher or teaching assistant this kind of thing is guaranteed to catch interest in your third-form physics or design and technology class amongst the boys, especially if you get them to make one on a breadboard and use a cheap robot chassis such as sold by Mindsets.
Ian Lang, February 2015