So I'm building a line following robot that is directly wired from the Atmega8 to a L293 motor driver chip and then obviously to some motors.
The Atmega8 is sending manual PWM signal to the L293 driver on the forward pins. By that I mean I have code like:
void motor_pacer();{
ticked++
if( ticked <= duty_cycle)
PORTD |= LEFT_FORWARD;
else if(ticked <= period)
PORTD &= ~LEFT_FORWARD;
else
ticked=0;
}
All other pins on the L293 are logic low. Except obviously for the 2 Vcc pins which are supplied by a 6V battery and also for one enable.
Without the L293 motor driver in all the voltages are showing what I expect. Importantly the enable to one motor is high while the enable pin to the other is low and PWM is being sent to one forward pin. However when I insert the L293 motor driver in both motors switch on and the voltage on both enable pins has become high.
Hmmm… assuming that there’s no extra code somewhere that turns the enable on (since the output pin has been tested as staying low), and that the PORTD pins PD6 and PD7 are configured as digital outputs, the only other sources for this problem are in the wiring/soldering, or in the L293 IC itself.
If you’ve got a spare L293 try dropping that in to see if you get the same problem. A photo of your wiring might help us track down the problem.
Everything looks fine, are you able to attach the full code? At this stage I can only imagine that there’s a wiring error or solder bridge/short somewhere on the actual board.
I’ve taken out both the motors and the signals on the motor driver are as one would expect. Importantly one enable is low as well as the corresponding forward and reverse pins. However when a motor is connected to our working side (ie high inputs), then the other side goes high aswell.
Yeh I’ve got a multimeter and oscilloscope etc. I have tested the resistance between a few pins, mainly just the motor outputs and the enable pins and all the resistances are in the mega ohms.
I added a 15nF capacitor between the enable pin that is meant to be off and ground and I got this waveform from the enable pin.
But importantly the enable that was low is still being pulled high when the motor is connected.
What’s crazy is that the inputs (forward and reverse) that are given to the ‘on’ motor switch when the motor is connected. ie the one that was high goes low and the one that was low goes high… I’m pretty sure