VoxCommando
Arduino & Other Home-made Gadgets (that work with VC!) => Arduino support => Topic started by: Dave on August 05, 2015, 12:22:38 PM
-
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
- Download NodeMCU Flasher: https://github.com/nodemcu/nodemcu-flasher (https://github.com/nodemcu/nodemcu-flasher)
- Download Transparent Bridge Firmware: https://github.com/beckdac/ESP8266-transparent-bridge (https://github.com/beckdac/ESP8266-transparent-bridge)
- Download Putty: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html (http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html)
- Connect your ESP to your PC using a (3.3V!) ftdi:
(https://voxcommando.com/forum/proxy.php?request=http%3A%2F%2Ffs1.directupload.net%2Fimages%2F150805%2Ftemp%2Fhy9rrvem.jpg&hash=a831e0aaa98a5bf603dd5582838c6e8cf8e9f98e) (http://www.directupload.net/file/d/4070/hy9rrvem_jpg.htm) - Open NodeMCU Flasher
Select the port
(https://voxcommando.com/forum/proxy.php?request=http%3A%2F%2Ffs2.directupload.net%2Fimages%2F150805%2Ftemp%2Fddr7j2qo.png&hash=429b1bc84a44538fd9ad6ba981897cc29419341b) (http://www.directupload.net/file/d/4070/ddr7j2qo_png.htm) - Check Advanced Configuration:
(https://voxcommando.com/forum/proxy.php?request=http%3A%2F%2Ffs1.directupload.net%2Fimages%2F150805%2Ftemp%2Frbx53mkf.png&hash=bdfbcb579792544dd10f09f89f0059c671db6788) (http://www.directupload.net/file/d/4070/rbx53mkf_png.htm) - Flash 0x00000.bin:
(https://voxcommando.com/forum/proxy.php?request=http%3A%2F%2Ffs2.directupload.net%2Fimages%2F150805%2Ftemp%2Fr42zzhee.png&hash=0e213849ad3b31f81f92b5f6d5613ba862a4b7b7) (http://www.directupload.net/file/d/4070/r42zzhee_png.htm) - Flash 0x40000.bin:
(https://voxcommando.com/forum/proxy.php?request=http%3A%2F%2Ffs1.directupload.net%2Fimages%2F150805%2Ftemp%2Fkr2gk93v.png&hash=a6a45c692093c5f56ebea0245b9abed8e3d23a0d) (http://www.directupload.net/file/d/4070/kr2gk93v_png.htm) - Disconnect GPIO0 from GND
Restart your ESP!
The ESP should now create its own WiFi-network. Connect your PC to this network. - Open Putty and start a Telnet connection to the ESP. This should open a terminal window.
(https://voxcommando.com/forum/proxy.php?request=http%3A%2F%2Ffs2.directupload.net%2Fimages%2F150805%2Ftemp%2Fnodgj4kb.png&hash=120a45a7d46e0ac90468461af1506796938e0767) (http://www.directupload.net/file/d/4070/nodgj4kb_png.htm) - Type +++AT
The ESP should answer with OK
If not, try reflashing the firmware.
Type +++AT MODE 3
Type +++AT STA YourWiFiName YourWiFiPassword
Type +++AT BAUD
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!
-
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
- Download and install Arduino IDE 1.6.5 (or later):
https://www.arduino.cc/en/main/software (https://www.arduino.cc/en/main/software) - Start Arduino IDE and go to Preferences. Enter http://arduino.esp8266.com/stable/package_esp8266com_index.json into Additional Board Manager URLs field.
(https://voxcommando.com/forum/proxy.php?request=http%3A%2F%2Ffs1.directupload.net%2Fimages%2F150809%2Ftemp%2Fxlk5oj3n.png&hash=2246e425861c916b0e94d7c4a8fe0d217bef1b72) (http://www.directupload.net/file/d/4074/xlk5oj3n_png.htm) - Connect your ESP to your PC using a 3.3V FTDI
(https://voxcommando.com/forum/proxy.php?request=http%3A%2F%2Ffs2.directupload.net%2Fimages%2F150809%2Ftemp%2Fe5feyg5b.jpg&hash=f0337587140e763489c433e56494a1091483f14d) (http://www.directupload.net/file/d/4074/e5feyg5b_jpg.htm)
If you work with an ESP-01 module, use the wiring from Option 1. - Choose Generic ESP8266 Board in the tools menu
- After choosing the port you can upload your sketch with the following settings:
(https://voxcommando.com/forum/proxy.php?request=http%3A%2F%2Ffs1.directupload.net%2Fimages%2F150809%2Ftemp%2Fj3eu848o.png&hash=4c611496d2e6b1e0f58aee75dd57b29be146597a) (http://www.directupload.net/file/d/4074/j3eu848o_png.htm)
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 (http://www.esp8266.com/viewtopic.php?f=29&t=3787)
-
::bow Great work Dave!
-
I'm looking forward to seeing "Option 2" !
-
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?
-
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?
-
Here is also some text to the picture: https://importhack.wordpress.com/2014/11/22/how-to-use-ep8266-esp-01-as-a-sensor-web-client/
-
Option 2 is now available! :)
-
Awesome. Looks pretty straightforward.
Thanks Dave! :hugs
-
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?
-
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)!
-
Now it looks like the MySensors stuff is ported to the ESP8266 :yay
http://forum.mysensors.org/topic/1870/esp8266-wifi-gateway-port-for-mysensors/1
-
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
-
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.
-
@mexicanto
you can take a look in this forum: http://www.esp8266.com/viewforum.php?f=27&sid=b51604943ad23bb6b1dc399a4fc9c354
-
Thank you Dave and Kalle,
I need both, sending and receiving from/to VC-Arduino
because i need all the 3 pins (at least) (1 analog + 1 button + led)
this post is my project
http://voxcommando.com/forum/index.php?topic=1679.msg21000#msg21000
Kalle, I was reading that forum, but thank you for your support, is greatly appreciate
I'm going to experiment with the module and arduino, and I will post my results
thanks again, and happy new year
-
Hi Everybody,
I am working witha esp8266-01
i am able to turn on and off a led if i open a web browser and type:
http://192.168.1.2/gpio/1
http://192.168.1.2/gpio/0
on and off, respectively
and the web page respond:
GPIO is now high
GPIO is now low
respectively too
I have tried this in the LCB
TCP.Single.WrileLn /gpio/1\x0a 192.168.1.2 80
with no success, any help will be greatly apreciate
thanks
-
You must use the scrape action in the LCB.
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.2.0.9-->
<command id="386" name="ESP8266" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
<action>
<cmdType>Scrape</cmdType>
<params>
<param>http://192.168.1.2/gpio/1</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>TTS.Speak</cmdType>
<params>
<param>the LED is now ON</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<phrase>set pin to high</phrase>
</command>
-
It works perfect !!!
Thank you very much Kalle !!!
Also, any suggestion to do the opposite ?? push a button on the esp8266
and generate an event on VC ?
I know i have to program the ESP8266 as a server, not a client
thanks again
-
If you are able to program the udp function on the ESP, you can send a message which starts with - "VC.TriggerEvent&&""event name&&""payload1&&""payload2&&" ...
-
Thanks again Kalle,
I will try that tomorrow and share my results
-
Why all the quotation marks Kalle?
-
Haha sorry - this is how it looks in the arduino code:
String udpMsg = "VC.TriggerEvent&&""RF read&&"+String(mySwitch.getReceivedValue())+"&&"+...
-
Still looks wrong to me. Is there something wrong with your browser?
Shouldn't it be more like this?
String udpMsg = "VC.TriggerEvent&&EventName&&"+String(mySwitch.getReceivedValue())+"&&Payload2Here"
-
No, with my browser is everything ok. I copied the code from our blaster sketch and it works fine.
-
Kalle, James is right. The two quotation marks between "...&&" and "RF read&&" are not needed and don't make sense.
-
Hello,
I flashed this firmware and everything is working perfectly. But after I enter the wifi ssid and password,it gets connected but how do I find the IP address ? Does it have an AT command to get the IP address info ?
-
Can you use your router to view connected clients?
-
Yes,I can do that but that is not a convenient way to do that because there are thousands of types of routers and each having different settings .
By the way, can this firmware support uploading program to arduino over the air ?
-
That’s it!
The ESP should now connect to your network. You can find its IP e.g. with AutoScan-Network.
Presumably you only have one router...
Anyway did you try AutoScan-Network as suggested in the instructions?
-
Are you using the ESP as bridge for an arduino or are you using it as a stand alone chip? For the second option it is possible to integrate OTA updates.
I'm using the ESP mostly with a static IP, but if not you can use e.g Network Scanner:
http://www.heise.de/download/network-scanner-ee167ca09e83ae01b01f10e9710d23a3-1460199860-2613270.html (http://www.heise.de/download/network-scanner-ee167ca09e83ae01b01f10e9710d23a3-1460199860-2613270.html) to find the IP.
-
I have 3 different routers in my office and another router at home. so I was trying to find another way.
I did not exactly get that part. Where do I do the autoscan thing ?
-
Dave, I am using it as ESP-bridge connection. Giving it a static IP would be a good idea but how do I give it a static IP ? I will try the autoscanner thing.
-
Sorry, I'm only using the ESP as stand alone chip. I don't think there is an easy way to use static IP with the serial bridge. For more information you should have a look at the Github page: https://github.com/beckdac/ESP8266-transparent-bridge
-
Hey guys,
Could anyone tell me how to know the connection status ? Are there any AT commands for that ?
I am using the option 1.
-
Maybe this posting can help you, but only if your ESP use a static IP
http://voxcommando.com/forum/index.php?topic=1301.msg11234#msg11234 (http://voxcommando.com/forum/index.php?topic=1301.msg11234#msg11234)
-
Hey guys,
Could anyone tell me how to know the connection status ? Are there any AT commands for that ?
I am using the option 1.
Do you want to know the status from VoxCommando's point of view or from within your Arduino code?
-
What is voxcommando's point of view ?
I am using the option 1, so just burning the transparent bridge firmware. Not using any arduino code.
-
+++AT STA should print the SSID (and password) of the router the ESP is connected to. Is that what you are looking for?