This is an old revision of the document!
The ADuCM3029_demo_esp8266 is a Wi-Fi demo project for the EVAL-ADICUP3029 base board with additional EVAL-ADXL362-ARDZ shield, created using the Analog Devices Cross Core Embedded Studio.
The ADuCM3029_demo_esp8266 project uses the EVAL-ADXL362-ARDZ shield which has an ADXL362 3-axis MEMS accelerometer and a incorporated NHD-C12832A1Z-NSW-BBW display (128×32). However, for this example the display is not used.
The EVAL-ADICUP3029 is designed for IOT (Internet of Things) applications in mind, and therefore comes with on board Wi-Fi ESP8266 module.
Also, in order to fully make use of the IOT capability, MQTT messaging protocol is used as it is extremely simple and lightweight.
The following is a list of items needed in order to replicate this demo.
Details of how to create an Adicup3029 project from sources can be found here: https://github.com/analogdevicesinc/EVAL-ADICUP3029/wiki
The source code and include files of the ADuCM3029_demo_esp8266 can be found here:
For more information on importing, debugging, or other tools related questions, please see the tools user guide.
#define SCAN_SENSOR_TIME 500 // msecs
#define ACCEL_CFG_ACT_TRESH 50 // msecs #define ACCEL_CFG_INACT_TRESH 50 // msecs
#define ACCEL_CFG_ACT_TIMER 100 // msecs #define ACCEL_CFG_INACT_TIMER 10 // msecs
#define WIFI_SSID "****" #define WIFI_PASS "****" #define SERVER_ADDR "****"
The program connects to a WiFi network and to a TCP MQTT broker. After receiving the SUBACK confirmation from the server, the program enters an infinite loop where it waits for an ADXL-362 interrupt which is triggered when the acceleration on any axes is greater than 50 mG. Afterwards, the program publishes the x, y, z readings on adxl topic. A subscriber to this topic can view this information.
This example uses the Eclipse Mosquitto which is an open source (EPL/EDL licensed) message broker that implements the MQTT protocol versions 3.1 and 3.1.1. However, the user is free to use his favorite MQTT broker with minimal changes. MQTT provides a lightweight method of carrying out messaging using a publish/subscribe model. This makes it suitable for “Internet of Things” messaging such as with low power sensors or mobile devices such as phones, embedded computers or microcontrollers.
Alternatively, there is an additional step-by-step procedure written which can be used in combination with the steps outlined below. The combination of both procedures should be enough to get most PC/laptops working. Installing and Configuring Mosquitto
cd C:\Program Files (x86)\mosquitto\mosquitto.exe -v
It should look like the following picture
Make sure that your computer or laptop is connected to the same network you are going to configure in the parameters.h file. Once you run the executable, Mosquitto assumes that you are running on that network.
SSID = "" //Service set identifier, name of the WiFi network to connect the ESP8266// PASS = "" //WiFi network password// SERVER_ADDR = "" //IP of the mosquitto broker from the previous step// SERVER_PORT = "1883" //by default is 1883//
cd C:\Program Files (x86)\mosquitto\mosquitto_sub -t adxl
This command subscribes to the topic and will display the accelerometer data. It should look similar to the image below.
The official tool we promote for use with the EVAL-ADICUP3029 is CrossCore Embedded Studio. For more information on downloading the tools and a quick start guide on how to use the tool basics, please check out the Tools Overview page.
For more detailed instructions on importing this application/demo example into the CrossCore Embedded Studios tools, please view our How to import existing projects into your workspace section.
For more detailed instructions on importing this application/demo example into the CrossCore Embedded Studios tools, please view our How to configure the debug session section.
The ADuCM3029_demo_esp8266 project use basic ARM Cortex-M C/C++ Project structure. This project contains: system initialization part - disabling watchdog, setting system clock, enabling clock for peripheral; port configuration for SPI, accelerometer sensor; ESP8266 initialization - UART and GPIO.
In the srcs/app_src folder you will find the source file for the main application:
End of Document