Introduction: How to Make Your Own Wireless fidelity Gateway to Connect Your Arduino to IP Network ?

As and then umpteen people you think Arduino is a very good resolution to act up home automationand robotic !

But in terminal figure of communicating Arduinos just come with serial links.

I am working on a robot that need to be permanently connected with a server that runs artificial intelligence code.
I tried to use RF network as I am used to do for domotic but it is not efficient enough. Atomic number 3 the robot moves I lav not use the Ethernet Arduino Shield. Arduino Wifi Buckler are expensive and seems to me to be old plan.

I needed something that seat exchange data in a very simple and efficient elbow room with a server.

That is wherefore I decided to conception a Gateway based on the very inferior and power efficient ESP8266 microcontroller.

Hera you can find how to habitus the electronic component and download the software system.

I used this gateway for Home automation and for Robotic.

This takes part of a spheric home automation substructure you can have a look present

I made another instructable that role a ESP8266 shield and avoid bonding

Supplies

Step 1: How Does It Work out ?

The Gateway is based on an ESP8266 module.

This faculty is connected from one side with the serial link from the past side to IP mesh with the Wifi.

It acts as a black boxwood. Data packets forthcoming from the serial link up are dispatched to an Information processing/Udp port and vis et versa.

You just let to set your own shape (Information processing, Wireless fidelity ...) at one time the prime time you will power on the Gateway.

It can transfer either raw ASCII and double star information (no more HTTP, JSON...)

Information technology is designed to connect objects with server nursing home ready-made softwares that involve fast and buy at transfers of short packet of data.

It is easiest to use with Arduino Mega that have more than one UART (Arduino Mega e.g.) merely can run also with a UNO.

Step 2: What Are the Intense Functions ?

Mostly it is a black box that convert and send serial data to UDP packet boat in both slipway.

It has 3 LED that indicates the status and traffic of the Gateway.

IT provides a GPIO that can be used by Arduino to wait for the Gateway to be WLAN and IP connected.

It runs in 3 different modes that are set with switchs:

  • Gateway mode that is the normal mode
  • Configuration mood used to set the parameters
  • Debug mode that is for debuging modality

Most of the parameters can be modified to convulsion your of necessity.

Step 3: Build of Material

On top of your Arduino you will need

  • 1 x ESP8266 module - I choose the MOD-WIFI-ESP8266-DEV from Olimex that costs around 5 euros that is quite easy to role.
  • 1 x 5v magnate source
  • 1 x 3.3v power governor - I use LM1086
  • 1 x 100 microfarad capacitor
  • 1 x ULN2803 APG module (can exist replace past 3 x transistors)
  • 8 x resistors ( 3 x 1K, 1 x 2K, 1 x 2.7k, 1x 3.3K, 1x 27K, 1x 33k)
  • 3 x LED (ruby, green, blue)
  • 1 x Breadboard PCB
  • some wires and connectors

During the construction steps only, you will need

  • 1 x FTDI 3.3v for the configuration
  • Soldering iron out and tin

Before soldering information technology is crucial to setup all the components on breadboard and check over everything is ok.

Step 4: Let's Start With the Electronic on the Bread board !

The electronic layout is available in Fritzing format.

You can download it here the step 1:

https://github.com/cuillerj/Esp8266IPSerialGateway/blob/master/GatewayElectronicStep1.fzz

Just practise as scheme by taking handle to the electric potential.

Recall that ESP8266 does not support voltage higher than 3.3v.
The FTDI essential equal set to 3.3v.

Step 5: Let's Go to the Software !

Get's start with the Gateway side

I wrote the encode with Arduino IDE. Thus you need ESP8266 to be known as board by the IDE.
Select the appropriate board with Tools / boards menu.

If you bash not see whatever ESP266 in the list that agency you may have to install ESP8266 Arduino Addon (you can find here the process).

All the code you need is available on GitHub. It is time to download it !

The principal code of the Gateway is there: https://github.com/cuillerj/Esp8266IPSerialGateway...

On top of standard Arduino and ESP8266 includes the main encrypt need these 2 includes:
LookFoString that is accustomed manipulate strings and is there: https://github.com/cuillerj/LookForString

ManageParamEeprom that is used to say and computer memory parameters in Eeprom ans is there: https://github.com/cuillerj/ManageParamEeprom

Once you get all the encipher it's sentence to upload it into the ESP8266.
First link the FTDI to an USB port of your computer.

I advise you check the connection before trying to upload.

  • Fit the Arduino serial monitor to the new USB port.
  • Set the speed to 115200 both cr nl (defaut speed for Olimex)
  • Power on the breadboard (ESP8266 comes with software that deals with AT commands)
  • Base "AT" with the serial tool.
  • You must get "OK" in refund.

If not check your connection and look at your ESP8266 specifications.

If you got "OK" your are ready to upload the write in code.

  • Power off the breadboard, wait a a few seconds,
  • push on the black micro-swith of the ESP8266. It is normal to get roughly garbage on the serial monitor.
  • Press connected the upload IDE as for an Arduino.
  • After the upload completed determined serial speed to 38400.

You volition undergo something as in the moving-picture show.

Congratulation you with success uploaded the code !

Step 6: Let's Do the Configuration !

The configGPIO essential be set to 1 for entering in configuation mode.

At the start scan the WIFI by entering the control: ScanWifi. You will see a tilt of the detected network.

  • Then set your SSID by entering "SSID1=yournetwork"
  • Then set your password away enterind "PSW1=yourpassword"
  • Then enter "SSID=1" to delimit the on-line network
  • Enter "Restart" to connect the Gateway to your WIFI.
  • You butt control you got an IP by entering "ShowWifi".
  • The sexy LED will cost on and the red Light-emitting diode blinking.

It's time to define your IP server address past entering the 4 subaddresses (server that wish run the Java test cipher). For instance:

  • "IP1=192"
  • "IP2=168"
  • "IP3=1"
  • "IP4=10"

The last mandatory step is to localize the UDP server listen port by ingress "listenPort=xxxx".

Enter "ShowEeprom" to check what you scarce stored in Eeprom

Now plug the GPIO2 to ground to leave the configuration mode.

Your Gateway is available to work !

There are some others commands you could see in the documentation.

Step 7: Let's Do the Arduino Incline !

First of all connect the Arduino.

If you feature a Mega it will atomic number 4 easiest to start with. Nevertheless you sack use a Uno.

To determine your work the best is to utilise the case.

You can download it there: https://github.com/cuillerj/TestSerialLinkLibrary

Information technology include SerialNetwork code that is here: https://github.com/cuillerj/SerialNetwork

Just upload the code exclusive your Arduino.

The jet LED is blinking each time Arduino send data.

Dance step 8: Let's Doh the Host Side !

The server model is a Java program that you can download here: https://github.com/cuillerj/ESP8266SerialUdpGatewa...

Just run it

Look at the Java console.

Take the Arduino monitoring device.

Arduino send 2 incompatible packets.

  • The first one contains the digital pins 2 to 6 status.
  • The s one contains 2 random values, the potential dro level of A0 in mV and incremental count.

The Java program

  • print the received information in hexadecimal format
  • reply to the primary openhearted of data with a random on/off value to set on/off the Arduino Light-emitting diode
  • reply to the second kind of information with the received number and a random time value.

Step 9: It Is Time to Do Some Bonding !

It works on the breadboard !

It is time to make it more robust by bonding parts on a PCB.

Happening top of what you did with the breadboard, you essential add 3 connectors.

  • C1 1 x pin one that will beryllium use for entry in network tincture style.
  • C2 3 x pins one that will be use to switch between running and shape mode.
  • C3 6 x pins one that will exist used to tie the Gateway either to a Arduino operating room a FTDI.

C1 connected to GPIO2 has to be manually grounded if you want to activate the network traces.

C2 connected to GPIO 4 can embody typeset in 2 different positions. Nonpareil that set to ground for the convention gushing mode and one set to 3.3v for entry in shape mode.

Determined all the components on the PCB reported to the diagram and later start to solder to set about the final product !

Step 10: Let's Serve the Final Tryout !

First the Coffee test program.

Connect the Arduino.

Power on the Gateway .

And look at the Java cabinet, the Arduino monitor, the Arduino LED and the Gateway LEDs.

Step 11: You Can Adapt This Design to Your Own Requirements !

Regarding the hardware

  • If you choose some some other ESP8266 you leave have to adjust to the specifications.
  • If you choose other 3.3v governor it must pitch over 500mA and you will have to adjust the capacitance.
  • You canful modify the LED resistors to set the brightness.
  • You can suppress all the LED but I recommend to keep at least the red along.
  • You can substitute the ULN2803 past 3 transistors (or less I you choose not to keep the 3 LED).
  • I did test but there it mustiness work with 3.3v Arduino boards. Just connect Tx Rx to the 3.3v connector.

Regarding configuration

  • You can store 2 different SSID and switch
  • You can modify the GPIO used

Regarding the software

  • You can practice any you want simply please let me know if you come up some improvements.

Be the First to Share

Recommendations

  • Anything Goes Contest 2022

    Anything Goes Contest 2022