Thank you for reading my post. I have been stuck on this for several weeks now! I am trying to turn ON/OFF a DC motor from Arduino IOT Cloud. I have set up the cloud and added the switch. Everything works well with an LED: it lights on and off as needed, but the motor does not turn on or off. Below is the circuit I have set up.
My circuit specs are as follows:
- I'm not using a UNO as the image illustrates, rather I'm using an Arduino MKR WiFi 1010, but the connections of the pins are exactly the same: LED at PIN 3 and Motor at 7.
- The diode I am using is 1N4001.
- The transistor I'm using is TIP120.
- The motor I'm using is 5V DC Motor.
- 270 Ohm resistor on the transistor circuit and 220 Ohm on the LED circuit.
The Arduino code I made is as follows:
#include "thingProperties.h"
#define LED_PIN 3
#define MOTOR_PIN 7
void setup() {
pinMode(LED_PIN, OUTPUT);
pinMode(MOTOR_PIN, OUTPUT);
setDebugMessageLevel(2); // For debugging of cloud integration
Serial.begin(9600);
delay(1500);
initProperties(); // initialize cloud properties
ArduinoCloud.begin(ArduinoIoTPreferredConnection); // Connect to cloud
}
void loop() {
ArduinoCloud.update(); // Update cloud background services
}
void onMotorChange() {
if (motor) {
// Motor & LED ON
digitalWrite(LED_PIN, HIGH);
digitalWrite(MOTOR_PIN, HIGH);
} else {
// Motor & LED OFF
digitalWrite(LED_PIN, LOW);
digitalWrite(MOTOR_PIN, LOW);
}
}
All my setup seems to be be correct, but it just is not working. I have researched a lot but to no avail. I have tested with a different motor just to be sure, but it also does not work. I'm not sure where I have made a mistake.
Please help me. Thank you very much.
-
1never use an arduino as a power supply ... there is a good chance that the arduino will become an expensive fusejsotola– jsotola2020年01月23日 22:42:52 +00:00Commented Jan 23, 2020 at 22:42
-
Thank you for the tip, i do not have an external power supply that's why i resorted to the 5V pin. in regards to my question do you see why am facing this issue?Abdeen M.– Abdeen M.2020年01月24日 08:50:07 +00:00Commented Jan 24, 2020 at 8:50
2 Answers 2
The TIP120 is a poor choice because of the approximate 10% - 14% voltage drop across it. Try the circuit with a logic level, low Rds MOSFET.
For a more in-depth answer, please see this answer: https://electronics.stackexchange.com/a/388468/165322
-
Comments are not for extended discussion; this conversation has been moved to chat.VE7JRO– VE7JRO2020年01月23日 22:29:40 +00:00Commented Jan 23, 2020 at 22:29
-
Hello VE7RO, hope you have been great! thank you for your input from before, i got everything working. Now am working on making a PCB of it but i couldnt been to find an SMT version/replacement for the RFP30N06LE, i was wondering if this would work assets.nexperia.com/documents/data-sheet/PMV15UNEA.pdf since my aplication does not really reach the limit of 60 V or 30 A, while this provides good Rds, Thanks!Abdeen M.– Abdeen M.2020年02月20日 20:54:11 +00:00Commented Feb 20, 2020 at 20:54
Okay i managed to solve it, the issue was actually my circuit wiring. Below is an image with the correct setup for the transistor or MOSFET.
I have changed the TIP120 to RFP30N06LE as VE7JRO suggested:
The TIP120 is a poor choice because of the approximate 10% - 14% voltage drop across it. Try the circuit with a logic level, low Rds MOSFET.
but that with the circuit in question does not work. I have not tested the circuit attached with this answer using a TIP120 but i suspect it would work as well. Finally i added a 9V battery as jsotola suggested:
never use an arduino as a power supply ... there is a good chance that the arduino will become an expensive fuse
but i have not tested using the 5V Arduino pin again i suspect it would work as well.
Bonus:
If anyone was wondering how i made these images i used TinkerCAD
Thank you all
Hope this Helps!
Explore related questions
See similar questions with these tags.