Author Topic: Motor controller help!  (Read 1032 times)

0 Members and 1 Guest are viewing this topic.

Offline ManlishPotatoTopic starter

  • Regular Contributor
  • *
  • Posts: 52
  • Country: se
Motor controller help!
« on: May 01, 2019, 01:21:23 pm »
Hi!
I've been ripping my hair of trying to get this project to work >:( >:( >:(, but seemingly no matter what i do i haven't been able to make it work reliably.
It's real simple really, just a atmega328 (non p) -pu + SN754410NE (essentially a l293 quad half-bridge).
The motor is a small 3-6 volt 100mA dc motor. The motor and micro-controller are driven by separate voltage, 6v@500mA and 5v@100mA respectively.

What happens is that i'll connect high or 5v from atmega to the motor controller, the motor spin from 1sec to at best 1min, when suddenly the 5v from atmega will collapse to 0v, and will remain like that until i reboot it.:palm:
My instinct was at first to directly connect atmega to motor controller without resistor pulled to ground like i did when prototyping with uno. But that didn't work at all with a raw atmega. At this point i have no idea as to why this isn't working.

Schematic and picture:
https://drive.google.com/drive/folders/1f7N4JG-nSVDko5vl9TXt3NpuTDINw7SS?usp=sharing

I'm not sure if this is a incredibly stupid question, but any answers are appreciated!
Thanks in advance!
ManlishPotato
 

Offline Psi

  • Super Contributor
  • ***
  • Posts: 10249
  • Country: nz
Re: Motor controller help!
« Reply #1 on: May 01, 2019, 01:44:13 pm »
The first thing i see looking at your schematic is that you've not grounded both of the ATMega's ground pins.
Pin 8 is missing a ground.
Both Pin 22 and Pin 8 must be grounded externally.


Also you seem to have 3 power rails   VCC ,  5V  and 6V
Should that 5V on pin 16 of SN754410NE actually be VCC ?

« Last Edit: May 01, 2019, 01:49:48 pm by Psi »
Greek letter 'Psi' (not Pounds per Square Inch)
 
The following users thanked this post: ManlishPotato

Offline ManlishPotatoTopic starter

  • Regular Contributor
  • *
  • Posts: 52
  • Country: se
Re: Motor controller help!
« Reply #2 on: May 01, 2019, 01:48:09 pm »
Whoops! That was a schematic errror. In the real world pin 8 is grounded, i should also note that the two separate voltages are connected via ground.
 

Offline Psi

  • Super Contributor
  • ***
  • Posts: 10249
  • Country: nz
Re: Motor controller help!
« Reply #3 on: May 01, 2019, 01:49:55 pm »
Another thing is that you need some supply rail decoupling capacitors.
Put a 100nF cap between VCC and GND on each IC, as close as possible to the ICs two power pins.
Also put one between V6 and GND right at the SN754410
So 3x 100nF caps in total.
If you dont have any 100nF (0.1uF) caps you can use 1000nF (1uF) or anything in between

Without these the inductive spikes from the motor maybe getting onto the supply rail and crashing the ATMega


Also, breadboard connections suck for reliability.
« Last Edit: May 01, 2019, 01:57:11 pm by Psi »
Greek letter 'Psi' (not Pounds per Square Inch)
 
The following users thanked this post: ManlishPotato

Offline ManlishPotatoTopic starter

  • Regular Contributor
  • *
  • Posts: 52
  • Country: se
Re: Motor controller help!
« Reply #4 on: May 01, 2019, 01:54:57 pm »
Oh! sorry! There are to voltage rails, 5v and 6v (these have a common ground) 5v in the schematic is the same as vcc. 6v is only used once and that's for pin 8 on motor controller, I.E this this for powering the motors.
i'll uppdate the schematic :)
 

Offline Psi

  • Super Contributor
  • ***
  • Posts: 10249
  • Country: nz
Re: Motor controller help!
« Reply #5 on: May 01, 2019, 01:55:54 pm »
Yep, add some caps like in my previous post and see if that helps.
Greek letter 'Psi' (not Pounds per Square Inch)
 

Offline ManlishPotatoTopic starter

  • Regular Contributor
  • *
  • Posts: 52
  • Country: se
Re: Motor controller help!
« Reply #6 on: May 01, 2019, 02:09:03 pm »
hmmm, i think the SN754410 has isolated logic and motor supply and also has a internal clamp diode, but i'll try it though.
I tried with 100R instead of 220R resistors on the input pins of the SN754410, and this did make it work continuously, yet it draws about 37mA witch is right at the 40mA absolute limit.
I think i'll try what you said + some higher resistors like 200-500R what do you think?
 

Offline Manx

  • Contributor
  • Posts: 39
  • Country: pl
Re: Motor controller help!
« Reply #7 on: May 01, 2019, 02:59:08 pm »
Does it hang when you don't connect the motor?
How exactly do you supply power for the logic and for the motor? Is arduino supply regulated?
 
The following users thanked this post: ManlishPotato

Offline ManlishPotatoTopic starter

  • Regular Contributor
  • *
  • Posts: 52
  • Country: se
Re: Motor controller help!
« Reply #8 on: May 01, 2019, 03:04:21 pm »
It does not "hang" or float which i think is what your trying to say. The supply is a linear bench power supply.
 

Offline Manx

  • Contributor
  • Posts: 39
  • Country: pl
Re: Motor controller help!
« Reply #9 on: May 01, 2019, 03:13:22 pm »
What I meant is that I understood that the atmega crashes after some seconds of operation. I was curious if it crashes without the motor actually connected.

I asked about the power supply since I'm wondering if the motor can somehow cause a voltage drop for Atmega. On Uno it has it's own regulator. I'm wondering how do you make 5V and 6V from one supply. Maybe there could a source of voltage drop, if any exists.

To add do the list of my questions: Do you have firm ground connection between atmega and SN754410, both are firmly connected to the power supply rails, so the power is not supplied by their I/O pins? These breadboards and jumpers can be very fiddly.
 
The following users thanked this post: ManlishPotato

Offline ManlishPotatoTopic starter

  • Regular Contributor
  • *
  • Posts: 52
  • Country: se
Re: Motor controller help!
« Reply #10 on: May 01, 2019, 03:49:50 pm »
To answer your questions:

It does not crash without the motor connected.

The voltages are created via the two channels of my lab power supply.

Vcc and GND are supplied via each pin like in the schematic, i have tested all the connections and they are solid.

With that said i finally made it work with the help of Psi! The solution was smoothing capacitors and 1k resistors pulling the input to gnd.
 

Offline ManlishPotatoTopic starter

  • Regular Contributor
  • *
  • Posts: 52
  • Country: se
Re: Motor controller help!
« Reply #11 on: May 01, 2019, 03:55:43 pm »
Yaaaaaas! Finally got it working!
Thanks to Manx and especially Psi for helping me! :-+ :-+
Here is a video of it working:
https://drive.google.com/file/d/103jWOH9mpPur37N9i3-5pMfdRGwpzIQK/view?usp=sharing
 

Offline Manx

  • Contributor
  • Posts: 39
  • Country: pl
Re: Motor controller help!
« Reply #12 on: May 01, 2019, 04:06:01 pm »
Congrats! :)
 
The following users thanked this post: ManlishPotato


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf