So my problem is that I want to control a motor using the Arduino Mega 2560. I found a motor driver (L298n - datasheet) and want to use this one. So my problem is that I want to have a isolation of the 2Grounds, because of the inductive interferences. The curcuit is Circuit this one. And as you can see I want to seperate the arduino and the normal ground. The 5V for the Vcc is from the Arduino and the 7-8V is coming from a Battery.
As knut_ny mentioned you'll need optocouplers (The L298N does NOT use them internally).
I've done lots of projects with L298N h-bridges and I've never used isolated grounds. Most of the time I've using the 5V regulator on the L298N PCB to power the microcontroller.
Where did you get this schematic?
I don't think the schematic is a functional circuit. If you're not using current sense resistors, then "SEN_A" and "SEN_B" should be connected to ground.
Normally the enable pins are pulsed and direction pins (IN1 - IN4) are set high or low to control the direction of the motors.
As you have the h-bridge wired, you won't be able to control the two motors independently.
You know you can get L298N board with diodes and a voltage regulator for about $3 on ebay right?
Are you planning to use the L298 to control the robot you mentioned in an earlier thread?
If so, the L298N isn't a great choice for those motors. It might work okay and as I mentioned earlier, L298N boards are cheap. The L298N PCBs from ebay are cheap enough to be considered disposable. It's not a too big a deal if you burn out a couple now and then (but you didn't hear such reckless advice from me).
If you use the L298N on these motors, make sure you use at least two. You certainly wouldn't want to use a single L298N to drive four of those motors.
Besides the L298N not being a good match because of the current requirements of the motors, the L298N is also not a great choice because it robs your battery/motor system of power. There are lots of better h-bridge options.
If you are still planning to use these motors, let us know and we can suggest better h-bridge solutions.
sry I didn't give a answer earlier but I was out of town for the past days. As you asked if we use the L298n for these motors, I want to tell you yes we do. Why we did make the Enabled Inputs and the In1and In3, In2 and In4 also parallel was because the 2 motors what will be connect will be having the same speed, because they will both be on the same side of the roboter.
Just to let you know too we are using 2 of the L298n. I will add a update of the schematics right under this. I don't know if I mentioned this, but this project is part of the school so our teacher wanted us to do this on our own and not just buy it on the internet.
We have 2 grounds right there the Arduino ground and another Ground. Also we have as supply voltage once a Battery and once we put it down to 5V for the Vcc input of the L298n.
We will have 2 curcuits for the whole roboter, so we can controll the 2 sides indipendently
So my problem is that I want to have a isolation of the 2Grounds, because of the inductive interferences.
Have you put bypass capacitors on the terminals of the motors and the L398 have you kept the motor wiring and the motor power supply wires away from the arduino?
It seems strange that you have this problem, what symptoms does it cause?
Can you post a picture of your project please?
Is all your motor wiring neat twisted pairs kept away from the Arduino? Have you added 0.1uF caps
across the motor terminals? Are you running the motor supply wiring entirely separate from the
Arduino supply wiring (you mustn't share wires between logic and high current motors).
MarkT:
Is all your motor wiring neat twisted pairs kept away from the Arduino? Have you added 0.1uF caps
across the motor terminals? Are you running the motor supply wiring entirely separate from the
Arduino supply wiring (you mustn't share wires between logic and high current motors).
TomGeorge:
Hi,
Have you put bypass capacitors on the terminals of the motors and the L398 have you kept the motor wiring and the motor power supply wires away from the arduino?
It seems strange that you have this problem, what symptoms does it cause?
Can you post a picture of your project please?
Tom.....
Well I am not sure if you saw ma last post I made with the update but this shouls be working I just need to make it up now.
@TomGeorge I have not put bypass capacitors on the terminals of the motors and the L298n, because I didn't seem to need them. We did not actually test it yet so we are not aware of the symptoms yet, but theoreticall we could have problems with them tahts why want to get rid of them asap. We wil build the whole thing on Thursday I could give you more info then and a picture ofcourse if you so desire.
@MarkT I did not add any capacitors would I need them really? I am not sharing the same wires as the supply and the arduino, but the peaks of the motors, because it is induktiv, will go back towards the arduino through the L298n thats why we need this seperation in order to keep our arduino save.
If you got other question which would help you and me I am open
Why do you think inductive spikes will get to the Arduino if you common the grounds? Don't you
realize the diodes on the motor driver clamp the spikes and the motor supply is separate from the
Arduino 5V?
BTW you always need decoupling and that includes the motor supply - which because it is high current
needs large decoupling capacitor, say 470uF or that sort of amount. This will also help reduce interference
carried on the motor supply wiring.
The caps on the motor reduce the interference generated by the motor's commutator sparking (and
reduce the sparking too).