Selenoid motor not responding to NodeMCU instructions
Posted: Sat Dec 04, 2021 4:05 pm
I just start a project migrating from Arduino Uno to NodeMCU, basically this projects control some selenoid motors triggered by a website instructions. For example: if website returns 2, the motor #2 start work.
I hace everything ready, fetching from the website but, the motors are not working. In Arduino Uno works but in NodeMCU did not.
The selenoid motor is this one from AliExpress: the 3v --> https://es.aliexpress.com/item/4000807560712.html
The circuit I made is like this:
NodeMCU / Motor
D2 -> Positive motor wire (red wire).
3.3V -> Positive motor wire (red wire).
GND -> Negative motor wire (black wire).
All this is attached to a protoboard for easy my work, but those are the connections of the circuit.
At otherwise, the code looks something like this:
I also tried instead of pin name D2 use 4 corresponding of the GPIO number. Didn't work.
The wired part is in Arduino Uno the same code and same circuit works perfectly, but in NodeMCU not.
I hace everything ready, fetching from the website but, the motors are not working. In Arduino Uno works but in NodeMCU did not.
The selenoid motor is this one from AliExpress: the 3v --> https://es.aliexpress.com/item/4000807560712.html
The circuit I made is like this:
NodeMCU / Motor
D2 -> Positive motor wire (red wire).
3.3V -> Positive motor wire (red wire).
GND -> Negative motor wire (black wire).
All this is attached to a protoboard for easy my work, but those are the connections of the circuit.
At otherwise, the code looks something like this:
Code: Select all
void setup() {
Serial.begin(115200);
pinMode(D2, OUTPUT);
}
void loop() {
analogWrite(D2, 0);
delay(3000);
analogWrite(D2, 100);
delay(3000);
}
I also tried instead of pin name D2 use 4 corresponding of the GPIO number. Didn't work.
The wired part is in Arduino Uno the same code and same circuit works perfectly, but in NodeMCU not.