ESP8266 & Arduino Webserver

For the last week, I worked on evaluating the potential of the ESP8266 as a WiFi communication device. It is a cheap WiFi module that is well-documented and thus suited to our project. 

This is a guide that compiles and clarifies a few different sources into one to set up and ESP and Arduino Uno as a web server. If connected to the same network as the ESP, you can visit its IP address and see a customizable web page. This is a cheap and easy implementation that can be used for an Internet of Things project.  

My starting point was an Arduino forum. First, I wired up the ESP and the Arduino, using this image as reference. Note: your board may say IO0 and IO2 rather than GPIO 0 and 2. Additionally, some boards may denote an EN pin instead of CH_PD pin. 



I wired it up like this: 

Arduino Pin ———- ESP Pin

2 ———————– TX

3 ———————– RX 

GND ——————- GND

3.3V ——————– 3.3V (or 3V3)

3.3V ——————– CH_PD (or EN) 

If you use the Arduino’s RX and TX pins directly, wire the ESP RX to the Arduino TX and the ESP TX to the Arduino RX. If you use these pins directly, you may need to disconnect them from the ESP when uploading your code, as these are used to upload code from the computer to the Arduino. 

You will likely have to wire wrap, solder, or buy an ESP with headers added on to it, as it cannot be placed directly on the breadboard in its original form (this will connect the two rows of pins on the ESP to each other).


Once wired, upload the code available here. Note, this code has been borrowed and slightly modified (comments added and syntax error fixed) from 

Information, original code, and guide video can be found at a post on

Caveat: If using this code, note that lines 26-32 are commented out and can be removed. Additionally, lines 49 and 60 should be updated with variable name cipSend, rather than the incorrect cipsend. 

AT-Command Information:

The setup in the code used several AT-commands to reset the ESP, set it up as a wireless access point, and get information from it. More detail about these can be found at itead’s AT command page. They can be used to update ESP firmware, change the SSID, add a password, etc. 


The ESP and Arduino wired up The ESP and Arduino wired up 

The ESP and Arduino wired up 

Working with Adafruit RFM9x (LoRa) Radio Transceiver Modules


LoRa is a Low Power Wide Area Network (LPWAN) hardware set for creating long range (2km to 10s of kilometers) star or star-of-star networks. OPEnS Lab is evaluating LoRa for on of it’s 4 Internet of Ag communication options (others being close-range RF (100m), WiFi, and GSM).

In this blog, one of our URSA Engage research students (Marissa K) got the LoRa radios up and running using this Adafruit tutorial. Below, she will detail what she had to do and modify to get this working with the RFM96W 433MHz breakout board – along with accompanying example code. These cost only $20.

Arduino Uno connected to Adafruit's LoRa RFM9x Radio Transceiver ModuleArduino Uno connected to Adafruit's LoRa RFM9x Radio Transceiver Module

Arduino Uno connected to Adafruit’s LoRa RFM9x Radio Transceiver Module


Here’s the setup pictured above:

LORA                  Arduino Uno

Vin —————– 5V

GND ————— GND

GO (IRQ) ——— 2

SCK —————- D13

MISO ————– D12

MOSI ————– D11

CS —————— D10

RST —————- D9

GND ————— GND

Antenna connection – soldered a 6.5 inch wire (green) that corresponds to a frequency of 433 MHz

Note: The Arduino Uno is capable of supplying either 5V or 3.3V.   For this project I went with the 5V supply since additional components used for collecting data from the surrounding environment will require a higher voltage and the LoRa pins use level shifting circuitry to safely power the chip with 3.3V-6V of direct current.  With level shifting circuitry the MOSI on the LoRa radio operates on a 3.3V logic level while sensors connected to the power rails on the breadboard are powered with 5V.

LoRa Radio breakouts communicating; LED attached to designated "Receiver" LoRa ModuleLoRa Radio breakouts communicating; LED attached to designated "Receiver" LoRa Module

LoRa Radio breakouts communicating; LED attached to designated “Receiver” LoRa Module


The source code used to program the LoRa radio’s to receive and transmit data came from the Adafruit website and AirSpayce’s Radiohead Library.  In the Arduino IDE, the radio frequency was changed from 915.0 to 433.0 MHz.  Here are the links for the code I used to program the transmitter and there receiver.

Serial Output:

Once the transmitter Arduino was programmed and powered, it initialized and began sending signals awaiting a response from another radio unit on the same frequency.  If no response was found, then the following output would appear on the serial monitor:

Transmitter radio without a recepientTransmitter radio without a recepient

Transmitter radio without a recepient

Once the receiver Arduino was programmed and powered the two began sending and receiving packets of information – in this case a simple message, RSSI signal strength, and a count incrementing after each successful exchange:

Communication between transmitter and receiver LoRa Radios; output printed to the serial monitor in Arduino IDE.Communication between transmitter and receiver LoRa Radios; output printed to the serial monitor in Arduino IDE.

Communication between transmitter and receiver LoRa Radios; output printed to the serial monitor in Arduino IDE.

Now that the two LoRa radios can communicate we should be able to transmit raw data from one radio to another.  The next step is to attach a sensor to the transmitter Arduino that collects such data in real time.  Over the next few days I will be using Maxbotix’s XL-MaxSonar-EZ sensor to collect data and transmit that data to the receiver.  The MB1220 sensor that I will be using detects objects within 15ft from the front of the sensor and outputs the distance away in inches when connected to the analog pin A0 on the Arduino and the breadboard’s ground and power rail supplying 5V.

Here is the data sheet for the MB1220 as well as the code used to test MB1220.

Maxbotix's XL-MaxSonar-EZ sensor MB1220 with wires connected to Ground, Vcc, and Pin3 (Analog output).Maxbotix's XL-MaxSonar-EZ sensor MB1220 with wires connected to Ground, Vcc, and Pin3 (Analog output).

Maxbotix’s XL-MaxSonar-EZ sensor MB1220 with wires connected to Ground, Vcc, and Pin3 (Analog output).

 Marissa Kwon Undergraduate Student Researcher



WSAN Pro Trinket 3V Shield Schematics

By: Chet Udell

First versions of Pro Trinket 3V Shield Schematics Are Here!

One shield is for the receiver hub (aka Gateway) and won’t change too much except for exploring different terminal protocols for the Gateway (e.g. Direct to computer serial like thi one, vs WiFi, LoRa, and Bluetooth). Basically, only the header for the nRF24L01+ was needed.

The other shield is a general-purpose i2c (designed with the MPU6050 3-axis accel + 3-axis gyro in mind, but can take any i2C device) with 3 general purpose Analog inputs. A custom circuit on the Analog input lines enables a choice of either using a 2-wire voltage divider (variable resistor) sensor, or a 3-pin powered sensor (takes 3V, GND, and outputs analog signal). This is meant to serve a wide multitude of general sensing purposes, where one may also choose to not populate the analog or i2c headers if not being used. Also comes with a LiPo JST battery connector, power switch. Header for nRF24L01+ also required.

OPEnS Wireless Sensor/Actuator Net (WSAN)

By: Chet Udell

Introducing a new, modular, open-source, open-hardware wireless sensor-actuator network toolkit for environmental and agricultural projects. The main idea is: may people in environmental and agricultural fields have need for (or could greatly benefit from) deploying sensor-actuator systems in their practice. However, the exact system of sensors for each individual is idiosyncratic to their unique environment, constraints, and line of inquiry, requiring customs systems be designed from scratch for each new project. This results in a barrier to entry for those who don’t have the background or time to learn and develop their own sensor-actuator systems. OPEnS WSAN proposes a plug and play, modular, reconfigurable architecture that would enable those with little-to-no expertise in engineering to quickly map out and assemble a unique system to fit their needs in relatively little time.

Transmitter prototype with Adafruit Pro Trinket 3V, nRF24L01+, with Sonar and FSR sensors.Transmitter prototype with Adafruit Pro Trinket 3V, nRF24L01+, with Sonar and FSR sensors.

Transmitter prototype with Adafruit Pro Trinket 3V, nRF24L01+, with Sonar and FSR sensors.


A single hub will collect all transmitted data from nodes and translate data streams into WiFi for uploading onto a cloud storage service.

Sensor Nodes

Will be comprised of parents and children. There can be up to 6 unique parents directly connected to the hub. Children placed further away can communicate to the hub by passing messages along to their parent.

Actuator nodes

These nodes will receive commands from the hub to drive relays, motors, servos, valves, and other commonly used actuators. Messages may be sent in real time by the user sending commands to the hub, or automated through a cloud service like IFTTT (If This Then That). In this manner, hub may be programmed to alter the behavior of sensors or trigger events of actuators based on the behavior or events from other nodes.

Repeater Nodes

These simply extend the range of communication of nodes to the hub by relaying messages to their target destination.


I’m using the RF24Network library by maniacbug, which can be accessed on GitHub, or through the Arduino IDE Library manager. I’m also using the i2cdev library by jrowberg to manage communication with the MPU6050 IMU sensor (see below).

Progress to Date

I’ve begun preliminary work on evaluating the Nordic nRF24L01+ wireless transceiver radios with the Arduino Uno and Adafruit Pro Trinket 3V. These ultra-low power radios give significant range and adjustable data rate down to 250kbps. The datasheet is here. 2 sensor transmitters and one hub now work, will add more when more nRF radios arrive in the mail.

Sensors supported so far


  • None yet