OK first of all, yes the power supplies are separate, I have 6 x 1.2 volt AA NiMH batteries that power the 2 gear head motors (about 8.4 volts total when fully charged). And the arduino board is powered by a 9v NiMH battery.
1. Mount 3 ceramic 0.1uF capacitors on the motor like this: one between the leads, one between one lead and the motor case and the last one between the other lead and the motor case.
2. Twist the motor leads all the way to the PCB.
3. Mount a ceramic 0.1uF across the Sonar power pins (VCC and GND).
Usually this is enough.
1. I already did that
2. already did that too
3. I will try that
OK, HERE is the issue I tested a couple things and this is what I found... When I turn both the supplies on and the bot is running (in circles that is) I can actually unplug the 9v supply to the board and it still runs. The H-Bridge as you can see on the schematic link above requires a 5v logic supply and the motor output supply. To give the H-Bridge the 5v supply I used the regulated 5v out that the Arduino board can give. What I think is happening is that somehow the H-Bridge is leaking some of the motor supply voltage back to the logic supply of 5v. The reason why I think this is because when I monitor the voltage on components like the sonar's supply voltage, when I pug in the 9v battery supply to the Arduino it regulates 5v to the sonar and everything works fine. However when I flip the motor supply on the voltage coming out of the usually regulated 5v supply that Arduino gives, jumps up to about 6.5 volts, not good. Hence the reason why my sonar is malfunctioning is because the analog signal that it send to the ADC input in the Arduino is determined by the input voltage. My code is set up to convert 5v analog into its max distance, and 0v as its min distance, but if the supply voltage is bumped up to 6v, that throws off all the expected readings.
I don't just want to adjust the code because I'm pretty certain that if something requires a regulated 5 volt supply and it gets 6 volts, that's not good for it.
So here is my new question, what would be the best and easiest way to make sure those two power supplies stay separate? The two that come to my mind are:
A) make a regulated 5 volt power supply to the H-Bridge using the 8.2 volts that is used for the motor supply (use a step down linear regulator), but that is rather time consuming and I have limited pref board space left
B) since I have never used them I'm not sure, but I think there are diodes (zener diodes I think they're called) that have a break down voltage, so maybe I could use them to make sure that nothing more than 5v comes or goes out of the logic supply of the H-Bridge
I have never really had to deal with something like this before so if anyone has some advice on how to make sure those two powers supplies stay separated, I would appreciate any help.
Thanks in advance: Brandon