Tiny Braitenberg vehicle

Again a Braitenberg vehicle. This one is even smaller, than the previous one and comes on a custom PCB. It weighs 17 gramms, is driven by two pager motors, powered by a small lipo cell and controlled by an 8-pin ATtiny25V.

Schematic and parts

This tiny robot has a very low component count. At least for a robot, based on a microcontroller. That has, of course, some implications. It can handle only two sensors and the motors run only in one direction. A full H-bridge for both motors would need 8 transistors and more lines to control it.

So I decided to just use a single transistor to drive the motor. That means it can only run forward. Not a big deal for a Braitenberg vehicle.

Here is the parts list. Most parts are very common.

  • ATtiny25V, 2 kB flash RAM, ATTINY25V-10PU-ND
  • MPC1700 3.3 voltage regulator, MCP1700-3302E/TO-ND
  • 2 * light dependent resistors (LDR)
  • 2 * 10 kOhm resistor
  • 2 * 470 Ohm resistor
  • 2 * 2n3904 transistor
  • 2 * 1n4148 diode
  • 100n capacitor
  • 100u capacitor
  • Lithium-polymer battery, 3.7 V, 100mAh, HobbyCity
  • 2 * fuse holder
  • 2 * pager motor
  • heat shrink tubes
  • rubber tube
  • custom PCB
  • 6-pin ISP header

A bit tricky was to find the right rubber tube to build the wheels. I found these, which are normally used to connect tiny motors to a model stern tube. Because the inner diameter is a bit to wide, I used short pieces of cable isolation as an adaptor.

If you have pager motors with an attached weight on their shaft, you may want to take a look at the RobotRoom for instruction on how to get rid of the weights. I had no locking pliers, maybe that’s the reason why I ruined at least three motors. Mostly by twisting the shaft while trying to pull off the weight.

Software and programming

The software is straigt forward. Reading two inputs, the light sensors, and driving two ouput lines accordingly with a PWM signal.

But it turns out, that the software needs a lot of adjustments. First you have to figure out in what range the light sensors report values. Next, check at what PWM level the robot starts to move. Maybe even adjust the directional stability.

Programming the robot in circuit via the 6-pin ISP header didn’t work out in the first place. The programmer was not able to set the lines to high that were driving the transistors. So I soldered a socket in place and can now pull off the two 470 Ohm resistors. After programming I can re-insert the resistors. Can be seen on the left critter on the picture above. A bit awkward, but it works.

Demo

Tiny Braitenberg Vehicle from tinkerlog on Vimeo.

You should have a very clean surface for them to run on. If you put them on a table, as I did, be sure to have very good reflexes or put a kind of fence around them. Mine dropped off the table a couple of times. Mostly no dramatic damage, but the sensors got twistet and the motors sprung out of their holders.

Depending on the ambient light, the light source itself and the nature of the surface you may have to adjust the light sensors. As an example, if the surface is white and diffuses the light, then you would have to bend the sensors away from the surface, because the surface looks bright, even if the robot turns away from the light source.

Issues and conclusion

There are still a couple of issues to resolve.

  • Software improvements, use ADC in free running mode and use hardware PWM to drive the motors
  • Place the skid in the middle of the PCB.
  • There is no protection of deep discharging the battery, no idea how to solve this.
  • Add a small power switch.

Someone wanting to volunteer for some private beta testing and helping with improvements?

Besides these issues, these two critters are fun. There was a lot of testing, reprogramming and re-adjustment needed, to get them doing, what I thought they should do. But hey, that’s the way to learn something.

Links and downloads

34 Comments

  1. The most simple approach to prevent deep discharge of the capacitor would be using a reverse biased zener diode of e.g. 2.3 Volts or whatever the deep charge point is.
    I do not know if the diode would have some current limiting effect – but that is nothing a clever use of a transistor cannot cure.

    Like

  2. People interested in Braitenberg vehicles might like to look at the ‘tortoises’ developed by W. Grey Walter in the 1940’s /1950’s These were described in his book ‘The Living Brain’ and used 2 valves and 2 relays to produce a robot with very complex motions.
    I had the privelige to attend a lecture by him in about 1968, he was using a slide projector and pointed out that by using coloured backgrounds people would remember the slide better. I can still remember the magenta and deep yellow he used although I can’t recall the rest of the lecture.
    I’ve always wanted to build a modern equivalent of the tortoises, but the mechanics of the front wheel is beyond my capabilities.

    Best place to start looking is wikipedia :-

    http://en.wikipedia.org/wiki/William_Grey_Walter

    Like

  3. Hi, nice job ! That’s a really funny robot !

    Here are some tricks, I hope it can help you to improve your project !

    – LiPo deep discharging: You can monitor the voltage of the LiPo with the last A/D input (ADC0) and stop motor PWM (+ start blinking LED1 for example) when it reaches 3.5V. When the LED starts blinking you know that you have to charge the battery ASAP. (To measure the voltage, simply use a resistor voltage divider to prevent overvoltage from Vbat on pin1).
    If you don’t want to use the uC to do it, you can use for example a lm431 + transistor to cut power line when voltage is to low (it’s not a direct application from lm431 but you can use it as a kind of comparator with its integrated voltage reference)…

    – skid: I don’t understand why you put the skid in the front of the vehicle… It will be better if you put it on the back (that means the motors under the light sensors and the skid under the battery) because you will always pull on the skid and not push it.

    – SMD Components: You have made your own PCB, why didn’t you used SMD components ?? Not for the light sensors (you need THD to move it) but everything else could be twice smaller (DIP8 + socket against SOIC8… Or TO-92 against sot23) ! You can also use MOS transistor for Q1 and Q2 and then remove R4 and R5 (BS170 should do it…).

    If you need help, don’t hesitate to ask me !
    cHris

    Like

  4. Hi cHris,

    thanks for your suggestions.
    For the SMD parts, I was thinking of making it easy to build, even for beginners.
    For deep discharge protection, there is no ADC port left. But maybe I can re-use the LED pin for that.
    The lm431 looks promissing as well, thanks.

    Cheers,
    Alex

    Like

  5. this is really good..but may i know what is the aspected cost to make this Tiny Braitenberg vehicle

    Like

  6. I think you can use PB5 as an input AD pin instead of reset function. You have to change the fuses but it’s not a big deal…

    Like

  7. Great projet, congratulations.

    In your design you specify 5V but then you are using a 3.7V battery. Could you explain a bit more please?
    Also the pager motors. Are they 5V?

    Like

  8. Yes, you are right, that should be 3.7V.
    3.7V of the lipo battery is used to power the regulator and the motors. The pager motors are 3V I think. They had no rating.

    Like

  9. This is seriously cool :)

    I’ve got most of the parts on order, everything from the AVR programmer upwards! It might take me a while (and I think it’s going to have to be a bit bigger, my motors are 12mm diameter) but I’ll let you know how I get on.

    Like

  10. A quick question, which I’m guessing is related to the 5V confusion above, you’ve mentioned you used a 3.3V MPC1700 voltage regulator – but that would need a min input voltage around 4.3V, right?

    You’ve used the ATtiny25V which is good down to 1.8V, so I’m guessing a 1.8V or 2.5V voltage regulator made it into the final circuit?

    Like

  11. Hi Meurig,
    the MCP1700 is a low drop regulator, that means it should be stable at least at 3.4V, if I read the datasheat correctly.
    The idea is to run the controller and all other components at 3.3V and only the motors and the transistors at what the battery delivers (3.7-4.1 V).
    Cheers,
    Alex

    Like

  12. I’ve re-read the datasheet and you are (of course) correct about the MCP1700 not needed much voltage differential: typically 178mv + 3% of the output voltage for anything above 2.5V.

    This seems to suggest that it would be fine provided the battery stays about (1.03 * 3.3 + 0.178) 3.58V. So only really while the battery is fully charged.

    I believe the required input voltages are 3.27V, 2.75V and 2.3V for the 3.0V, 2.5V and 1.8V regulators respectively. Since you’re using the ATTiny25V the 2.5V would seem the ideal choice having an input voltage below the batteries deep discharge point and an output well into the input range for the chip. Of course, this change in Vcc will probably impact the design of the rest of the circuit…

    Like

  13. wow!! looks cool thanks for putting it! Good for beginners! can’t wait to build!
    THANKS!

    Like

  14. thanks!

    In your circuit is 10u, but in parts list are 100u, where is mistake?

    Like

  15. Pingback: I??k ?zleyen Robot
  16. For deep-discharge protection, you can use the ADC. Another external ADC pin wouldn’t be of any benefit anyway. The avr tiny25/45/85 have the feature of sampling the internal 1.1v reference, relative to VCC. You can use this to figure out absolutely what voltage the avr’s VCC is sitting at, and once it hits 3.0v or something alike, call the powerdown routines – which use less than one onehundredth of a milliamp. If you want to be extra safe, shut it off at 3.3-3.4v. You’ll probably want not to use brownout detection, as having that enabled consumes extra power, even in deep-sleep, unless you specifically disable it in software before going to sleep.

    This looks like a really cool toy! Thanks for sharing. :)

    Like

Comments are closed.