DeviceHive firmware for ESP8266

User avatar
Nikolay
Posts: 6
Joined: Thu Aug 13, 2015 12:39 am

DeviceHive firmware for ESP8266

Postby Nikolay » Thu Aug 13, 2015 1:13 am

Hello everyone!
I'm happy to present DeviceHive firmware for ESP8266!
DeviceHive is an Open Sources platform for IoT solutions.

Overview
DeviceHive firmware for ESP8266 is suppose to connect simple electronic devices with common interfaces to DeviceHive cloud service. Having this firmware on ESP8266 there is no need to write programs for hardware. Chip connects to specified remote DeviceHive server(which can be deployed in local network or in some cloud service) and waits for commands. Each command suppose to use some electronic interface to control some hardware connected to chip. It can be simple interaction with GPIO pins for turning on/off simple LED, relay or waiting some changes on pin from sensor. Also it is possible to connected more complicated sensors and actuators using UART or I2C bus. In other words, this firmware move the most commonly used interfaces right into cloud service where you can control your devices or even network of devices from any distance, from any point.

Example of connecting SSD1306 base OLED display: https://www.youtube.com/watch?v=gKgU6RzaxFU
Source code of program that sends data to display: https://github.com/devicehive/esp8266-f ... ample.html

DeviceHive server have two endpoints to send command commands or receive notifications: HTTP and Websocket. Developers can use any programming languages, any developer tools, any SDK that they prefer to interact with server and as a result with hardware. It is possible because all commands represent simple JSON string which sends via HTTP or Websocket. For example sending command with JavaScript looks like:

Code: Select all

      var xmlhttp = new XMLHttpRequest(); 
      xmlhttp.open('POST','http://exmaple.com/api/device/deviceId/command', true);
      xmlhttp.setRequestHeader('Authorization', 'Basic ' + btoa('user:password'));
      xmlhttp.setRequestHeader('Content-type', 'application/json;charset=UTF-8');
      var myjson = {};
      myjson['command"] = 'uart/write';
      myjson['parameters'] = {'data':'SGVsbG8sIHdvcmxkIQ=='};
      xmlhttp.send(JSON.stringify(myjson));

After receiving this command chip prints 'Hello, world!' in UART bus. The same idea with other interfaces.

Getting started:
First at all firmware have to be flashed into chip memory and chip have to be configured for using specified Wi-Fi network and DeviceHive server. Developers can build firmware and all tools for flashing and configuring by himself from sources. Or it can be downloaded from git repository: go to https://github.com/devicehive/esp8266-f ... er/release and download archive with the latest version.
For flashing chip needs to be connected to computer via USB-UART converter, CH_PD pin have to be connected to Vcc, GPIO15 and GPIO0 have to be connected to ground and 3.3 power supply should be used.
After assembling, connect it to computer. Install driver for your USB->UART converter. Make sure that virtual serial port is available in your system( virtual COM is present on Windows OS, '/dev/ttyUSB*' on Linux, '/dev/tty.*' on OS X). Unpack archive with firmware and flash it running 'esp-flasher-<your-os>' in terminal. Flasher automatically detects serial port and use '0x00000.bin' and '0x40000.bin' files for flashing. You can also you esp-tool for flashing - https://github.com/themadinventor/esptool
Now remove wire from GPIO0(live it float or connect to high), reboot device and connect to firmware with with 'esp-terminal-<your-os>' util. You can also use any other util that can connect to terminal via UART and support escape sequences, PuTTY or GNU 'screen' for example. Port parameters are: 115200 8N1.
Firmware terminal is a unix like terminal with few commands. It exists for chip configuring and debugging. To see debug output type 'dmesg'. To configure run 'configure' command. Follow instructions in terminal. You need to know DeviceHive server credentials for configuring. If you don't have DeviceHive server instance you could use free playgroun on DeviceHive site. Follow to http://devicehive.com/playground and register there and you will have your own DeviceHive server instance. DeviceHive server can be deployed in local network or on some cloud hosting services. Follow for DeviceHive server deployment instructions on http://devicehive.com
After rebooting you can send commands to DeviceHive server and ESP8266 perform them. List of accepted command is in this document - https://github.com/devicehive/esp8266-f ... SP8266.pdf You can use DeviceHive web admin control panel to send command for test purpose or learning. Go in web admin, 'Devices' tab, 'commands' subtab, 'enter new command'. Type command and parameters and press 'push'. After ESP8266 perform your command you can press 'refresh' button to see result.

You can find more detail instructions with images in 'DeviceHiveESP8266.pdf' file in archive with firmware. Or https://github.com/devicehive/esp8266-f ... SP8266.pdf (but be careful with only version, it can be newer than your firmware version)

Download
https://github.com/devicehive/esp8266-firmware/releases

Hope this firmware will be useful for your IoT or DIY projects! Any questions are welcome. Thank you!
Last edited by Nikolay on Thu Mar 02, 2017 6:31 pm, edited 2 times in total.

User avatar
Nikolay
Posts: 6
Joined: Thu Aug 13, 2015 12:39 am

Re: DeviceHive firmware for ESP8266

Postby Nikolay » Mon Sep 07, 2015 8:30 pm

Hello!

I'm glad to present new version of DeviceHive Fimrware for ESP8266 - v0.3
New key features:
- SPI support (mrfc522 connected with SPI sample - http://www.youtube.com/watch?v=VMT3v49d57g )
- onewire (1-wire master and DHT devices) support (iButton, DS18B20, DHT11 sample - http://www.youtube.com/watch?v=IuvxwCPNZCc )
- wireless configuring (see http://www.youtube.com/watch?v=sFD2TTZNNvo )

User avatar
Nikolay
Posts: 6
Joined: Thu Aug 13, 2015 12:39 am

Re: DeviceHive firmware for ESP8266

Postby Nikolay » Mon Nov 07, 2016 11:10 pm

Great news! DeviceHive firmware was updated to version 0.5.
What's new:
- uploadable web page
- mDNS
- local embedded web server with tools and samples
- local RESTful API
- support for some popular sensor devices
- bug fixes

This release contains plenty of features for usage in LAN. Each chip with DeviceHive firmware v0.5 becomes RESTful API service with HTTP server. Just connect your sensor and send HTTP request to chip. For example for BMP180 request is

Code: Select all

curl -i -X POST  \
     -H "Authorization: Bearer YourAccessKeyHere="  \
     http://chipId.local-or-ip-address/api/devices/bmp180/read

and response will be something like:

Code: Select all

{
    "temperature":25.5000,
    "pressure":100521
}

You can also upload your own web page and use JS for communication with REST. Build your devices with web interface easily with DeviceHive.
Full article about new firmware feature is here - http://docs.devicehive.com/blog/deviceh ... or-esp8266

User avatar
Nikolay
Posts: 6
Joined: Thu Aug 13, 2015 12:39 am

Re: DeviceHive firmware for ESP8266

Postby Nikolay » Mon Nov 07, 2016 11:10 pm

Documentation, list of new commands and supported sensors are available here - https://github.com/devicehive/esp8266-f ... ESP8266.md

And latest firmware in action: https://www.youtube.com/watch?v=9CiY08dcsC4

User avatar
Nikolay
Posts: 6
Joined: Thu Aug 13, 2015 12:39 am

Re: DeviceHive firmware for ESP8266

Postby Nikolay » Thu Mar 02, 2017 6:30 pm

DeviceHive firmware v0.6 was released!

Changelog:
- fixes and improvements
- new devices support. Overall firmware supports:
- DS18B20, LM75 - temperature sensors,
- DHT11, DHT22, SI7021 - humidity sensors
- BMP180, BMP280 - barometric pressure sensor
- BH1750 - light sensor
- MPU6050 - 3-axis gyroscope and a 3-axis accelerometer
- HMC5883L - magnetometer
- PCF8574 - GPIO extender
- HD44780 - 2x16 4x20 displays(with PCF8574 adapter)
- MH-Z19 - CO2 sensor
- MCP4725 - digital to analog convertor
- PCF8591 - analog to digital and digital to analog converter
- ADS1115 - analog to digital converter
- INA219 - power monitor
- MFRC522 - RFID tag reader
- PCA9685 - PWM controller
- MLX90614 - contactless IR thermometer
- MAX6675, MAX31855 - thermocouple thermometers
- TM1637 - 8 segments LED display controller
- WS2812B - LED strip controller
- access point mode
- embedded pages redesign
- sample of using D3.js for plotting graphs from different sensors on embedded web server

You can download binary release here - https://github.com/devicehive/esp8266-firmware/releases
sources also available there.

Who is online

Users browsing this forum: No registered users and 2 guests