0
\$\begingroup\$

I am working on a robot with with the following specs:

  • Two coin type vibration motors rated at 3V for locomotion
  • Motors triggered using two darlington transistors (sample schematic shown below)
  • Transistors triggered using PWM pins on the microcontroller ATMEGA164PA
  • An IR transceiver module for communication
  • Using two coin cell batteries in parallel each rated at 3V, 300mAh

enter image description here

I am only receiving IR signals at the moment for which I am polling the RxD pin to check when it is slow and increment a counter each time the pin goes low (RxD is active low)

I am facing a strange problem. I am using PWM on Timer 0 to drive the motors and when I set the PWM on the OCR0x registers to 0 (or any other value), I noticed that the RxD pin starts to receive signals (getting low) even though I am not sending any signal to the transceiver module. When I disable Timer 0 though, everything is fine and the transceiver only receives when I send something to it.

I am not able to figure out why that is. Is there something wrong that I could be doing? I have a noise suppression capacitor close to the motors as well as the flywheel diode.

EDIT

Another interesting observation. When I drive the motors directly by switching on the GPIO pin (same pin as PWM_1) instead of using the PWM, I noticed that there is no interference with the IR transceiver which shows that the Timer is a problem.

Note: more observations to come as I make progress

\$\endgroup\$
2
\$\begingroup\$

For me there are 3 possibilities:

  1. This is a firmware bug There is nothing wrong with your hardware but there is a bug somewhere in your code. If you force your IR input to GND using a wire, solder or anything. Does the problem still occur?

  2. There is something at the input pin for the IR. You can assess that by plugging an oscilloscope at the IR pin of your MCU. Your motor is probably perturbing the IR part. Maybe you are using a sensitive front end for your IR. The motor cables might be to close to the IR parts?

    Solution: Better insulation, better decoupling, physically separating the wires, etc...

  3. There is nothing measurable at the IR input of your MCU but it's not a firmware bug. The problem might be the power supply. Do you properly decouple the power of your MCU? Where the motor power comes form? The same supply than the MCU? Is it regulated? It might be that the motor is drawing too much current or is creating too much noise into your power rails that the MCU get disturbed in some ways. Try to measure your power rails using an oscilloscope, if it is noisy or drooping, then this is your problem.

    Solution: Use a proper voltage regulator, put decoupling caps at the pin of the MCU but also across the power supply of the motor, close to the motor.

\$\endgroup\$
  • \$\begingroup\$ All three points are great. 1) I am absolutely sure there is nothing wrong with the code because its just a few lines at the moment. 2) The PCB is very small and you're right that might be the problem. 3) The MCU and the motors are both powered up through the same unregulated 3V, 300mAh battery which I think is the root of this problem. I notice that when the motors are turned on, the voltage drop as they try to draw a lot of current. Each motor is rated at 3V, 90mA. I have decoupling capacitors close the the IR transceiver as well as on each motor \$\endgroup\$ – David Norman Aug 13 '14 at 20:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.