Multi-sensor platform

Hello,

Following the successful modification of two servo motors for continuous rotation ( https://plus.google.com/collection/k4P1ME ) I now have a nice little platform on which I installed two IR detection sensors (movement, 3m), a ultra-sound distance sensor and a IR close range detection sensor (3-15 cm).

I also have a small breadboard, and room for other circuits (maybe the H-bridge?). A 9V battery powers the motors, while the microcontroller (Teensy 2.0) is powered by three AA batteries.

I seek your kind guidance on the following:

  1. Can I connect two motors and four sensors to the microcontroller ? Enough pins? Enough power?
  2. Can I drive two motors with one H bridge circuit? Would it be feasible to have it soldered on a circuit board apart from the rest of the electronics?
  3. Robot aim in life: avoid obstacles (ultrasound sensor, close range proximity sensor) but only operate when IR sensor detects human presence (only works when being watched - like a model employee).
  4. Would the code require a PhD ?

Thank you for your time

The IR sensor: http://www.produktinfo.conrad.com/datenblaetter/500000-524999/504927-da-01-de-PIR_BEWEGUNGSSENS_SCHW_5M_AMN31111J.pdf
The ultrasonic sensor: http://www.micropik.com/PDF/HCSR04.pdf
The close range sensor: http://www.produktinfo.conrad.com/datenblaetter/175000-199999/185311-an-01-fr-detecteur.pdf
The microcontroller: Teensy and Teensy++ Pinouts, for C language and Arduino Software

  1. Can I connect two motors and four sensors to the microcontroller ? Enough pins? Enough power?

Probably, but without specifics that's the only answer. I would recommend 2 sources of power, one for the motors and one for the sensors and processor.

  1. Can I drive two motors with one H bridge circuit? Would it be feasible to have it soldered on a circuit board apart from the rest of the electronics?

Most motor driver shields and modules can drive 2 motors. Usually need 2 or 3 pins per motor. If you use a module, it can be anywhere. Just keep power wires away from signal wires. You need to choose a driver that fits with your motor's current and voltage requirements.

  1. Robot aim in life: avoid obstacles (ultrasound sensor, close range proximity sensor) but only operate when IR sensor detects human presence (only works when being watched - like a model employee).

All but human detection is pretty easily done. Human detection is problematic as you will see if you search the forum. There have been many threads on the subject.

  1. Would the code require a PhD ?

No.

Hi,
First, the Servo motors only use one pin to drive their control input, right?? What would an H-bridge be for??
Also: 9V on servos?? Usually rated for 5-6 volts..

Enough pins....

Example code for collision-avoiding robot (Ultrasonic only) is HERE Maybe a start on the code for you...

Sorry, I some how missed the servo part. No motor shield or modules needed.

The motors are simple DC motors, with gears. They were servos but I modified them. As such, they only have two pins. They are powered separately, by a 9V battery. Do I not need an H bridge to drive them? Maybe two H bridges?

Thank you for the code - will look at it carefully.

I would like to control the motors with the microcontroller, as a function of sensor input, while powering the motors separately.

Cheers for your advice

So they are not continuous servos. Then my answer to your #2 question in reply #1 still applies. If you want forward and reverse on the motors you need an H-bridge, yes. If you want help choosing a motor driver we need to know the voltage (9V?) and the stall current of the motors.

No, they are not. My wording was confusing. Please bear with me - many things wich are obvious to you will not be so for me. Such as whether a special motor shield (or module?) is imperative, or if an H bridge can, and is meant to successfully replace it.

Thank you for the advice to keep power and signal wires separate.

This is the current I measured on one of the two motors:

@ 4.5V - 70 mA
@ 6V - 80 mA
@ 9V - 110 mA
Stall - 1.6A

A motor shield or module usually has a H-bridge motor driver on it so they are pretty much the same thing. You need a driver for the motor as the Arduino can't drive a motor. A single transistor can be used for uni-directional drive. For forward and reverse a H-bridge is used. The H-bridge can be part of a motor driver chip or built from individual transistors (only with very careful design). So a motor driver chip mounted on a board with the pin broken out for easy interface is a module or if it is made to plug on top of an Arduino it is a shield.

If you don't already have a driver (H-bridge), down the page there are some dual motor drivers, that should suit, for under $6.00US.
pololu brushed-dc-motor-drivers

Thank you for the clarification. I have found some examples of H bridge circuits - 4 transistors, as many diodes and some resistors. Seems basic enough to solder on a separate circuit board and have a module to drive the motor. I guess I’ll need two - one for each motor.

You stress that the design of the H bridge must be carefully made. You mean the calculations for current, etc?

I’m attaching the H bridge example I was planning of following.

BipolarHBridgeSchematic.gif

While that circuit may work, you need to be aware o the pitfalls. If the timing of controlling the transistors is not right, there is a brief dead short between V+ and ground (shoot through). And if certain combinations of pins are in the wrong state, there will be a dead short (and probably smoke). I would recommend a driver that he built in protection. I use the 754110 driver chip a lot, but your motors draw a bit more current than the 754410 is good for.

I read up on what you mentioned - indeed a ready-bought drive module is the best solution. However, until delivery I will attempt the following H bridge. It seems to have four inputs - one for each transistor / switch. Am I correct to assume these will go in my microcontroller?

I have found several examples of H bridge circuits - some have both PNP and NPN transistors, whereas others only have NPN. I suppose they both have merits and drawbacks? Which do you prefer if you were to build one yourself ?

I found an example which I’ve successfully prototyped, then soldered to a small circuit board. I now have two H bridge circuits, each meant to drive a motor (left and right wheels). Can anyone explain what the criteria is to choose the values for the four resistors?

Thanks for your advice.

Please try to understand H-bridges and transistors.

This circuit will output at most 4V to the motor - is that sufficient? If you apply higher voltage (>5V) to the bridge, you risk to kill the high side transistors. For higher motor voltages you need a more complex circuit.

If you don't synchronize the PWM outputs properly, you risk to kill all transistors at once. Avoid both pins being high at the same time.

The high side resistors can be as low as 125 Ohm. The low side resistors can be 1k.

Dr Dietrich, thanks for the reply. I am trying to understand H bridges and circuits, yes.

Can you please tell me how you know it can only output 4V to motors? It is indeed insufficient. I will end up buying a shield.

ecce_lex:
Can you please tell me how you know it can only output 4V to motors?

A 5V base voltage, supplied by an output pin, reduces by Vbe (0.7V) to 4.3V on the emitter of the high side transistor, regardless of the voltage on the collector. The low side transistor again drops at least 0.4V Vce saturation voltage.

For a higher motor voltage a level shifter is required for the high side transistor, or a PNP type has to be used.

It makes sense. Somehow I believed I could use the +5V from the microcontroller to control a higher, separate voltage. I had not realised the max voltage to motor leads was lower than the logic voltage.

Thank you.