ok, my sweet bot is working now, I have made the corrections according to the feedback I got from James N. Sears(countless thanks to you James) and here is the feedback :
A few things to look at:
According to this pdf the pinout from closest to farthest in the picture on the web page is emitter ’ base ’ collector. The emitter in an NPN transistor like the 2N3904 corresponds to the side with the arrow in the schematic. It looks like the transistors are wired backwards and you need to reverse the connections to the two outer pins (the middle pin, the base, is fine). Or you could turn the transistor around.
Second, and equally important, there are too many diodes in series with your connection to the power supply. My guess is that you started adding diodes until you measured 3V with a voltmeter. The problem with this is that _sort of_ like a resistor, the more current is flowing the more voltage will drop across the diode (but in a diode the relationship isn’t nice and linear like with a resistor). So if you want to measure the voltage, you need to do it with the motor connected, drawing power. You could get pretty close without the transistor, by just connecting the motor straight from the last diode to ground. However a pretty good starting point in most cases is to estimate the voltage drop across each diode as about 0.7 volts. This means you would need 3 diodes in series to drop the 2 volts between supplies (also the transistor will drop a bit of voltage so you might find that two work better if the motor can handle a bit over 3V). With 7 diodes in series from a 5V supply only a tiny bit of current can flow (enough to feed your voltmeter, but not enough for your motor).
Also, I don’t see the protection diode on the schematic and that you mention in the caption. It should be across the two outer terminals of the transistor, with the band pointed toward the collector (the pin farthest from us in the picture).
If you make those changes, the circuit _should_ work. Another thing to consider though is that the 2N3904 is only rated to carry an average of 200mA of current, which may be too low for your motors, but I’m not sure how much they take. It all depends on the specific motor, but you can measure how much it draws with a meter set to DC Amps. If this is a problem, I don’t see any reason that the same circuit should work with a TIP120 (the pins are different though ’ in a TIP120 they go Base ’ Collector ’ Emitter from left to right as you are looking at the part number) which can carry plenty of current, but you will probably only want 2 diodes in series with your power at that point, because the TIP120 drops more voltage than the 2N3904. If the circuit works with the 3904 and the transistor doesn’t get hot enough to burn you within a few seconds to minutes you are probably OK though.
One more thing ’ if you have any doubt as to whether or not your PIC is the problem, you can always pull the wire from the PIC pin and connect it to the 5V supply which should turn the motor on.
Hope this helps.
it was a good experience for me to make it a bot work, and it is even reacting to light. So couple of next steps :
I should make the two motors speed equal or as equal as I can do, right now it is going a little bit left( not much) for this I am going to use HPWM as friends suggested, I got a code example of this for my servo somewhere, I have found one in Tom’s site as well related to LEDs.
I am going to replace transistors with an H-Bridge so that I can add backwards capability to my photovore. And with that I can add an avoidance capability as well(when it is so close to light, just step back from the source)
I am thinking to expand the photovore’s I/O relationship which is digital right now. It can be either positive proportional or a gaussian function.
And at last but not at least, I am thinking to add some algorithm to make the photovore not more aware of the environment but actually comparing the environment according to the data it keeps for its previous experiences.. Could it be possible? I am going to experiment and see…
that’s it for now.