The use of the ESP8266 in the world of IoT

User avatar
By Rudolf
#34305 I have just assembled a WiFi controlled car kit, cost about 22 EUR (including shipping).
The WiFi control is with the smart phone orientation (forward, backward, left and right).
The ESP8266 works in Access Point mode, so you need no Internet for control.
The NodeMCU module (ESP-12E) and motor shield are already included.
You just need to supply 4 x AA batteries, and your smart phone (javascript program) of course :D .

The details and source code you can find on:
http://www.rudiswiki.de/wiki9/WiFiCar-NodeMCU

Regards, Rudolf
You do not have the required permissions to view the files attached to this post.
User avatar
By axpiri
#75405 I am looking for a help in the very same project!!

I am a teacher at 24 student class. Each one with a NodeMCU and Nodmcu Motor Shield trying to make a 2WD car run.

I think I have connected the pins properly and all the Digital OUTPUTS work well as long as I use them to ligh LEDS.

Anyway, at the point that we try to make the motors RUN it does NOT work at all.

I am using the D1 and D2 as PWM inputs and the D3 and D4 as rotation inputs but nothing works.

Simple code, make it run forward for 2 seconds backward for another 2 secondas.

The bridge for VI and VH is done.

I have opened a new issue in General discussions although this would have been a better place for this.

Any help would be nice!


#define D0 16
#define D1 5 // I2C Bus SCL (clock)
#define D2 4 // I2C Bus SDA (data)
#define D3 0
#define D4 2 // Same as "LED_BUILTIN", but inverted logic
#define D5 14 // SPI Bus SCK (clock)
#define D6 12 // SPI Bus MISO
#define D7 13 // SPI Bus MOSI
#define D8 15 // SPI Bus SS (CS)
#define D9 3 // RX0 (Serial console)
#define D10 1 // TX0 (Serial console)

void setup() {
pinMode(D1, OUTPUT); // PWM A
pinMode(D2, OUTPUT); // PWM B
pinMode(D3, OUTPUT); // Rotation A
pinMode(D4, OUTPUT); // Rotation B
}

// the loop function runs over and over again forever
void loop() {

analogWrite(D1, 1023);
analogWrite(D2, 1023);
digitalWrite(D3, HIGH);
digitalWrite(D4, HIGH);
delay(2000);
analogWrite(D1, 0);
analogWrite(D2, 0);
digitalWrite(D3, LOW);
digitalWrite(D4, LOW);
delay(2000);
}
You do not have the required permissions to view the files attached to this post.
User avatar
By axpiri
#75450
Rudolf wrote:Hello axpiri,
Did you use my Arduino software ?
http://www.rudiswiki.de/wiki9/WiFiCar-N ... i-car-AP.c

Regards, Rudolf



NO, I did not. I used a very simple code that moves the motor froward. Nothing else. I just wanted to check the motors, thats all.

I hope we could use your code in order to control the car wirelessly although I must make the motor work first.

This is our code. We have a problem on our HARDWARE I reckon and I cant find it.

#define PIN_D1 5 // gpio5 = D1 PWM_A
#define PIN_D2 4 // gpio4 = D2 PWM_B
#define PIN_D3 0 // gpio0 = D3 DA (A- A+)
#define PIN_D4 2 // gpio2 = D4 DB (B- B+)
void setup()
{
pinMode(PIN_D1, OUTPUT);
pinMode(PIN_D2, OUTPUT);
pinMode(PIN_D3, OUTPUT);
pinMode(PIN_D4, OUTPUT);
}

void loop()
{
digitalWrite(PIN_D1, HIGH);
digitalWrite(PIN_D3, HIGH); // DB HIGH
delay(2000); // wait
digitalWrite(PIN_D1, LOW); // DB LOW
delay(2000); // wait
digitalWrite(PIN_D3, LOW); // PWM_B LOW

digitalWrite(PIN_D2, HIGH); // PWM_B HIGH
digitalWrite(PIN_D4, HIGH); // DB HIGH
delay(2000); // wait
digitalWrite(PIN_D4, LOW); // DB LOW
delay(2000); // wait
digitalWrite(PIN_D2, LOW); // PWM_B LOW

}