I'm new to Arduino and apart from what I did at school, electronic circuits too.
I'm wanting to use Arduino to help control a motor.
I've managed to build a motor controller on a breadboard using PWM but would like to be able to control via my Arduino - so that I can also monitor RPM and adjust the speed to ensure RPM.
The circuit I've found works well. The pulse is generated by an NE555 IC which is sent to a IFRZ23N MOSFET.
The motor is powered by 12v so I'm unable to do this purely with Arduino.
I rebuilt the circuit using a 12v supply but connected the gate on the IRFZ34N to a PWM output on the Arduino. This isn't working.
What I've done is remove the IC and tried to let Arduino send the pulse (C3, D3, T1 and M1 remain (no switch involved yet).
I've now tried to add a transistor (NPN) to feed the 12V from the external power but this isn't working. I hooked an PWM analog output in to the base, the collector to +12V and the emitter connects to the Gate on the MOSFET.
I've now tried to add a transistor (NPN) to feed the 12V from the external power but this isn't working. I hooked an PWM analog output in to the base, the collector to +12V and the emitter connects to the Gate on the MOSFET.
No.
Emitter to ground, base to arduino through a resistor. Collector to gate of fet and also through a resistor up to +12V.
I rebuilt the circuit using a 12v supply but connected the gate on the IRFZ34N to a PWM output on the Arduino.
If it's really a IRFZ34N mosfet, that is not a logic level mosfet and won't operate with the +5vdc output pin from an Arduino. So you need to either add a switch transistor to turn on the mosfet with a higher gate voltage, or use a true logic level mosfet such as this:
Tried as suggested but the motor just runs flat out - I can see the voltage change across the transistor as I adjust the pot, but that's not how this is supposed to work is it?
What i did is build a two way H-bridge that takes the dc motor and allow it to go both ways and with PWM you can slow down and speed up and even stop/brake
The words of MAKE. " If you can't open it, you don't own it."
I can see the voltage change across the transistor as I adjust the pot
How are you seeing this?
Can you post a schematic of what you have, it sounds like you have wired it up wrong.
What pin are you using? Not all pins are capable of PWM output. Also post your code (use # icon).
Should I be using analogWrite or digitalWrite?
For speed control you need analogue.
Also, how should I determine resistor values?
Which resistor, the one into the base of the transistor or the one pulling up the collector / gate to +12v?
Have you connected the ground from the 12V supply to the ground of the arduino?
Ignore my comment about voltage - I was using a multimeter and adjusting the POT, and noticed a change in voltage... but this would be due to the PWM effect right?
Re: Ground, the 12v supply hasn't been grounded to the Arduino.
Am using Pin 9 for PWM.
Here is a schematic - sorry for it's crudeness - I placed a resistor as suggested in serial to base on the transistor but it was a the same as R3 (47 ohm)
No that circuit is very wrong and not what I told you. When that transistor turns on it is making a dead short to ground. It will be getting very hot. The 12V ground has to be connected to the arduino ground.
You need the resistor between the collector and the 12V. Then connect the gate to the transistor. 47R is way too low use something in the 1K to 10K range.
Thanks for the help guys - in the end I did get it working with the original MOSFET but it didn't work too well which was most likely due to my circuit and lack of experience/understanding.
Most of the problems I had was with faulty components (again due to me playing around!) but managed to get this working with minimal components: