neděle 7. února 2016

Arduino with ESP8266

Arduino with ESP8266 Basic Setup

Shopping list

  • ESP8266 Serial WIFI Wireless Transceiver Module Send Receive LWIP AP+STA arduino
    (Ebay Store)
  • New IIC I2C Logic Level Converter Bi-Directional Module 5V to 3.3V For Arduino
    (Ebay Store)
  • Arduino Mega
    (Ebay Store)

Setup

The ESP communicates via the serial link with Arduino. Connection is easy:

ESP   -- Arduino

RX    -- TX1 via the I2C level converter.
TX    -- RX1 via the I2C level converter.

GND   -- Ground

VCC   -- 3.3V source
CH_PD -- 3.3V source
GPIO0 -- 3.3V source
GPIO1 -- 3.3V source



Note: For TX and RX I used the I2C level converter which is working without any problem. Only confusing thing is that if you measure the voltage via multimeter on the HVx or LVx you always get the HV or LV value, no matter what goes in on the other side.

Programming

For Arduino Mega the situation is easier since we have the Serial1 right away, otherwise the SoftwareSerial needs to be used (not verified). 

The program is very easy:
void setup()
{
    Serial.begin(9600);
    Serial1.begin(115200);
    delay(500);
    Serial.println("Starting");
}
void loop()
{
   
    while (Serial1.available()) {
        Serial.write(Serial1.read());
    }
    while (Serial.available()) {
        Serial1.write(Serial.read());
    }
}
For sending the commands to the ESP module, configure the Arduino IDE so that CR and LF is sent, you choose that at the bottom right corner of the serial monitor window.

Note: Be aware that the ESP module may have different baudrate on the serial connection that is expected. For the the 115200 baudrate for the ESP serial worked.

External Sources

DC 5V Stepper Motor

DC 5V Stepper Motor

Shopping list

All excited to go for robotics I have purchased the:

"DC 5V Stepper Motor + ULN2003 Driver Test Module Board 28BYJ-48 for Arduino" from ebay store.

Setup

The connection was pretty simple, but be careful to power the motor from different source than via the Arduino 5V output. There is a combination of solenoinds controlled by the IN1, ..., IN4 pins on the driver.

Set the jumber as is on the photo to enable the stepper control.


Then all the magic is to program the set high or low values on the IN1...IN4 pins of the controller. I have written a small program for controlling the motor, source code to be provided.

Experimentally I discovered that the change in the solenoids configuration should not take faster than each milisecond. Using smaller time intervals, the motor stops rotating.

External sources: