0

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.

Circuit Design

My circuit specs are as follows:

  1. 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.
  2. The diode I am using is 1N4001.
  3. The transistor I'm using is TIP120.
  4. The motor I'm using is 5V DC Motor.
  5. 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.

2
  • 1
    never use an arduino as a power supply ... there is a good chance that the arduino will become an expensive fuse – jsotola Jan 23 '20 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. Jan 24 '20 at 8:50
1

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

2
  • Comments are not for extended discussion; this conversation has been moved to chat. – VE7JRO Jan 23 '20 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. Feb 20 '20 at 20:54
0

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.

enter image description here

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!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.