I'll list the brief, then what I already have access to, and hopefully it all makes a bit of sense.
If you have any suggestions, I'd be very grateful. I'm also happy to reply with how it all goes, and help out where I can as I learn.
I want to have 2 motors (attached to discs), that play out a predetermined path. So one will turn for 5 seconds, then stop for 3, then turn for 6, then go for 10 then stop. The second motor will turn for 14 seconds, stop for 4 seconds then turn for 6 seconds then stop. They don't need to take any inputs at all, just do as they're told.
1 x freetronics NDRIVE
1 x 12V 70RPM motor (N.B. I've bought 1 of each, as I figure I can use that as proof of concept, and buy another set if it works, or abandon and get something appropriate if not).
I've also got access to generic tools and parts for electronics (soldering iron, wire, tape etc).
You only need protection diode(s) over the motor(s) and a power supply for the motor(s).
The mosfet module is for led's and so. But to drive a motor, a protection diode is needed.
As you can see in this picture, there is a protection diode over the load (the motor):
If you connect it for the first time, I suggest not to use the 12V and not the motors. Try first to switch a led (with resistor to 5V) with the mosfet.
For the code, use the example of the blinking led, and use that to 'blink' the mosfet driver. The blinking led is an example sketch inside the Arduino development environment.
The LED for testing is a brilliant option. I hadn’t thought of that but really should have. Thank you.
The NDRIVE MOSFET unit has a 1k in series with the Gate, and a 10k parallel from Source to gate, and a zenner across the back of the transistor from source to drain, so if I’ve read it right, that should take care of the protection side of things. Is that right?
You really need the protection diode (flyback diode) over the load.
The 10k keeps the gate low, if the output pin of the Arduino is floating during power-up.
The 1k in series with the gate is to protect the Arduino, in case you connected something wrong.
The zener diode in the mosfet is not something to rely on. It protects the mosfet against static electricity if you pick it up.
The flyback diode protects against the high voltage spike of the load if it is switched off.
Glad I checked. :)
Will get hold of one before I put it into the system, and draw up a schematic so you can have a look over it and stop be bringing about the bad smokey smell.
Hoping this looks ok. The bit in the NDRIVE box is basically a small self contained module.
If this looks right, i'll get it made and tested, and then work on adding a second motor on a separate channel.
Thanks for any help.
The gate voltage is now 10/11 of the output of the Arduino. The IRLZ44N needs 4V in this situation, so you’re fine.
The ground current of the battery-motor-mosfet part could influency the Arduino or the gate voltage. So don’t use thin wires and make solid connections.
Excellent. Going to finish running this up tonight, and will see what's what.
Thanks again for your help on this. Definitely appreciated.
I've now added in a second motor, NDRIVE and wiring to D13, and I can control both with pre-designated high/low delays.
Now all I need to do is add a final digital input to have a MOM button start the path (probably with a few second delay).
Thanks again Krodal.
I'll upload the final schematic with the second motor, just in case anyone ever searches for something similar. Might throw the code up too once I get that right. :D
So that's the final product. I've written out some code that works well, although the front wheels that are supposed to be support only are causing a bit of friction. Once it has some more weight on it, it works well, and we're expecting a few kilos yet so it looks really good.
Thanks for posting the result.
The second mosfet should be connect to ground
But the minus of the USB Battery to Vin ? That can’t be right.
Why not use the voltage of the 8*1.5V batteries to Vin?
The Arduino uses little current, so the voltage regulator of the Arduino won’t get hot at 12V.
Nice pick up! Yes the second MOSFET is grounded, when I made out the second motor schematics I put the resistor to ground, thinking I'd connected one part to ground, but the resistor to ground is part of the NDRIVE component internally, so yes. Definitely grounded.
The reason for the separate power source, is I'm concerned that by the time we get done with all the testing, we may be pushing the end of our batteries, so any outsourcing I can do on the cheap, I will. I have a 'usb phone charger' given to me a while ago that barely gets use, and it's a nice little contained setup that slotted into place with almost no work, so I thought sure. :)
When it comes to the next thing I make with this (and this was a compulsory project that I hoped would show me a little scope) I'll definitely be utilising the built in power functionality.