News:

There is a soft-mute function which we use with the commands like "What song is this?" There is one for system volume, one for each of: MediaMonkey, XBMC, iTunes, MediaPortal.

Main Menu

HOW-TO: Add WiFi to your arduino projects with ESP8266

Started by Dave, August 05, 2015, 12:22:38 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

Dave

Option 1: Using the ESP8266 as transparent seraial bridge

What you need:
- Arduino
- ESP8266 module (e.g. ESP-01)
- FTDI with 3.3V
- computer/notebook with WiFi


That's it!
The ESP should now connect to your network. You can find its IP e.g. with AutoScan-Network.

Connect your ESP to your Arduino (RX <-> TX, TX <->RX)
CAUTION: The ESP module works with 3.3V while most Arduinos work on 5V! Since the ESP module draws a lot of current, you will probably not be able to power it by your arduino. (The RX/TX pins seem to be 5V tolerant and I connect them directly to my (5V) arduino, try at own risk.)

You can now send messages to the serial port of your arduino with the VC action TCP.Single.WriteLn! You need to add the IP of your ESP and use port 23. Make sure to append \x0A to every message!

Have fun!

Dave

Option 2: ESP as stand alone chip. Programming the ESP with Arduino IDE

What you need:
- ESP8266 module (e.g. ESP-12)
- FTDI with 3.3 V


Note 1: Some libraries might not work!
Note 2: Pin numbers match GPIO numbers!

You can find a simple sketch with an web server to toggle an LED here:
http://www.esp8266.com/viewtopic.php?f=29&t=3787

Kalle

***********  get excited and make things  **********

jitterjames

#3
I'm looking forward to seeing "Option 2" !

jitterjames

Quote from: Dave on August 05, 2015, 12:22:38 PM
You can now send messages to the serial port of your arduino with the VC action TCP.Single.WriteLn! You need to add the IP of your ESP and use port 23. Make sure to append \x0A to every message!

What about receiving messages back from the Arduino?  We previously used an event generated by the serial port.  Will we now get a TCP event?  In order to do this, we would need to use TCP.Client instead of TCP.Single?

Dave

#5
Quote from: jitterjames on August 05, 2015, 12:58:43 PM
What about receiving messages back from the Arduino? 

I did not try this. I will report back as soon as possible. Or maybe Kalle could try it, since I'm not at home the next few day?

Kalle

***********  get excited and make things  **********

Dave


jitterjames

Awesome.  Looks pretty straightforward.

Thanks Dave!  :hugs

jitterjames

#9
So for option2, we don't need to flash the firmware first?  Does that mean then that we do not connect GPIO0 to ground?

Or are we effectively flashing the unit every time we program it from the Arduino IDE?

Dave

We are flashing the firmware every time we upload a new sketch, so you have to connect GPIO0 to GND first (before powering the module)!

Kalle

***********  get excited and make things  **********

mexicanto

#12
Hello Dave,

By any chance, do you have an example/code that you can share ?

I refer to the option 1, esp8266 + arduino (the mini pro 3.3v)

I am trying to turn on/off a led, reading an analog value and trigger an event with a push button

Any help will be greatly appreciated

Dave

Hi mexicanto,
sorry, I don't have any example code. What you want to do should be possible in theory, but I never tried sending messages from arduino to VC using the serial bridge method. I don't use this method anymore at all. As long as you only need one analog input I would recommend using method 2 e.g. with a nodemcu board.

Kalle

***********  get excited and make things  **********