This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
resources:eval:user-guides:eval-adicup3029:reference_designs:demo_adxl362 [31 May 2017 10:46] – [Project Structure] Stefan Popa | resources:eval:user-guides:eval-adicup3029:reference_designs:demo_adxl362 [08 Mar 2021 07:21] (current) – [Obtaining the Source Code] adding in .Hex files Zuedmar Arceo | ||
---|---|---|---|
Line 2: | Line 2: | ||
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** 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. | ||
+ | |||
+ | <note important> | ||
===== General Description/ | ===== General Description/ | ||
Line 10: | Line 12: | ||
Also, in order to fully make use of the IOT capability, **MQTT** messaging protocol is used as it is extremely simple and lightweight. | Also, in order to fully make use of the IOT capability, **MQTT** messaging protocol is used as it is extremely simple and lightweight. | ||
+ | |||
+ | ===== Demo Requirements | ||
+ | |||
+ | The following is a list of items needed in order to replicate this demo. | ||
+ | * Hardware | ||
+ | * EVAL-ADICUP3029 | ||
+ | * EVAL-ADXL362-ARDZ | ||
+ | * Mirco USB to USB cable | ||
+ | * PC or Laptop with a USB port | ||
+ | * Software | ||
+ | * ADuCM3029_demo_adxl362 software | ||
+ | * CrossCore Embedded Studio (2.6.0 or higher) | ||
+ | * ADuCM302x DFP (2.0.0 or higher) | ||
+ | * ADICUP3029 BSP (1.1.0 or higher) | ||
+ | * Mosquitto Broker | ||
===== Setting up the Hardware ===== | ===== Setting up the Hardware ===== | ||
- | - Move the **S2 switch** to the **WiFi** position: {{ : | + | - Move the **S2 switch** to the **WiFi** position |
- | | + | |
- | - Plug the **EVAL-ADXL362-ARDZ** shield in the **EVAL-ADICUP3029** base board: {{ : | + | - Plug the **ESP8266** in the **P1** connector on the **EVAL-ADICUP3029**. |
+ | - Plug the **EVAL-ADXL362-ARDZ** shield in the **EVAL-ADICUP3029** base board. {{ : | ||
- Plug the USB cable | - Plug the USB cable | ||
- | ===== Configuring | + | ===== Obtaining |
- | This example uses the [[https:// | + | There are two basic ways to program |
+ | - Dragging | ||
+ | - Building, Compiling, and Debugging using CCES | ||
- | The program connects to a WiFi network | + | Using the drag and drop method, the software |
- | - [[https:// | + | |
- | - Double click the downloaded .exe file | + | |
- | - Make sure [[http:// | + | |
- | - Click next and finish the installation | + | |
- | - If everything is now in place, you should | + | |
- | - Type mosquitto.exe -v to start the broker in verbose mode:{{ : | + | |
- | - The mosquitto broker | + | |
- | - In the ESP8266.h header file you need to configure the following parameters: **SSID** - //Service set identifier, which is the name of the WiFi network to connect the ESP8266//, **PASS** - //WiFi network password//, **MQTT_SERVER** - //IP of the mosquitto broker from the previous step//, **PORT** - //by default is 1883// | + | |
- | ===== Outputting Data ===== | + | |
- | - You are now ready to run the program. If everything works fine, in the CrossCore | + | Importing |
- | - The program has connected | + | |
- | - The program | + | |
- | - Open another Command Prompt and navigate to the folder where mosquitto is installed and type **mosquitto_sub -t adxl**: {{ : | + | |
- | - At each ADXL-362 movement, an interrupt is triggered and as a result, the x, y, z information is published. In the console **// | + | |
- | }} | + | |
- | ===== Obtaining the Source Code ===== | + | |
- | + | ||
- | We recommend not opening the project directly, but rather import it into CrossCore Embedded Studios and make a local copy in your workspace. | + | |
- | The source code and include files of the **AduCM3029_demo_esp8266** can be found here: | + | The software for the **ADuCM3029_demo_esp8266** can be found here: |
<WRAP round 80% download> | <WRAP round 80% download> | ||
+ | Prebuilt ESP8266 Hex File | ||
+ | * [[https:// | ||
+ | Complete ESP8266 Source Files | ||
+ | * [[https:// | ||
+ | |||
+ | </ | ||
- | [[https://github.com/analogdevicesinc/EVAL-ADICUP3029/tree/master/projects/ADuCM3029_demo_esp8266| AduCM3029_demo_esp8266 | + | <WRAP center round info 80%> |
+ | For more information on importing, debugging, or other tools related questions, please see the [[/resources/eval/ | ||
+ | </WRAP> | ||
+ | |||
+ | ===== Configuring the Software (parameters.h) ===== | ||
+ | |||
+ | * ** Accelerometer scan interval** - how often to update sensor information. Set the // SCAN_SENSOR_TIME // parameter (// | ||
+ | |||
+ | < | ||
+ | #define SCAN_SENSOR_TIME | ||
+ | </ | ||
+ | |||
+ | * ** Sensor activity and inactivity thresholds** | ||
+ | < | ||
+ | #define ACCEL_CFG_ACT_TRESH | ||
+ | #define ACCEL_CFG_INACT_TRESH | ||
+ | </ | ||
+ | |||
+ | * ** Sensor activity and inactivity time** - // | ||
+ | |||
+ | < | ||
+ | #define ACCEL_CFG_ACT_TIMER | ||
+ | #define ACCEL_CFG_INACT_TIMER 10 // msecs | ||
+ | </ | ||
+ | |||
+ | * **Network parameters** Here you should set your Wi-Fi connection and MQTT information: | ||
+ | |||
+ | < | ||
+ | #define WIFI_SSID | ||
+ | #define WIFI_PASS | ||
+ | #define SERVER_ADDR " | ||
+ | </ | ||
+ | |||
+ | ===== Using an MQTT Broker ===== | ||
+ | |||
+ | 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 **// | ||
+ | |||
+ | ==== Installing the Mosquitto Broker ==== | ||
+ | |||
+ | This example uses the [[https:// | ||
+ | |||
+ | |||
+ | <WRAP center round help 60%> | ||
+ | Alternatively, | ||
+ | |||
</ | </ | ||
+ | - [[https:// | ||
+ | - Double click the downloaded .exe file, and install the Mosquitto program | ||
+ | - During the install, Mosquitto will ask you to make sure you have 2 other programs installed. | ||
+ | - Click the links within the Windows install wizard **BEFORE** completing the Mosquitto install. | ||
+ | - [[http:// | ||
+ | - [[ftp:// | ||
+ | - Refer to pictures outlined in the additional [[https:// | ||
+ | - Make sure these additional programs are installed before you continue | ||
+ | - Click next and finish the installation. | ||
+ | - You may run into an issue that says " | ||
+ | - After looking around, I found a great website to download the DLL files from, as well as a great video that shows you have to fix the issue, and it did work for me. //Please note, that this solution is **NOT** affiliated with Analog Devices, and Analog Devices assumes no responsibility for any problems or damages occurred during this process. // | ||
+ | - [[https:// | ||
+ | - [[http:// | ||
+ | - Re-Run the Mosquitto.exe file, inorder to complete the installation process. | ||
+ | |||
+ | ==== Setting up Mosquitto to Receive MQTT Data ==== | ||
+ | |||
+ | - With Mosquitto and other software properly installed, you should be able to run mosquitto. Open a Command Prompt and navigate to the folder where mosquitto is installed. The default location is C:\Program Files (x86)\mosquitto | ||
+ | - Type mosquitto.exe -v to start the broker in verbose mode. Copy this code block into your command line editor to navigate to the folder and execute the program:< | ||
+ | - The mosquitto broker is now running locally and has the same IP as your machine and by default runs on port 1883. Open a new Command Prompt and type **ipconfig** to get your local IP address | ||
+ | - In the parameters.h header file you need to configure the following parameters: < | ||
+ | SSID = "" | ||
+ | PASS = "" | ||
+ | SERVER_ADDR = "" | ||
+ | SERVER_PORT = " | ||
+ | </ | ||
+ | - Open a third Command Prompt and navigate to the folder where mosquitto is installed and type this command and hit the < | ||
+ | |||
+ | ===== Outputting Data ===== | ||
+ | |||
+ | - You are now ready to flash the program on the ADICUP3029 and run it. Before downloading the code, please press the **WIFI_RESET** button (**S4**) on the ADICUP3029. | ||
+ | - If everything works fine, in the CrossCore Embedded Studio console you should see: {{ : | ||
+ | - The program has connected to the local WiFi network, to the TCP mosquitto broker, subscribed to // | ||
+ | - The program will publish x, y, z data on the **// | ||
+ | - At each ADXL362 movement, an interrupt is triggered and as a result, the x, y, z information is published. In the console **// | ||
===== How to use the Tools ===== | ===== How to use the Tools ===== | ||
Line 67: | Line 155: | ||
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.{{ : | 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 src folder you will find the source | + | In the srcs/ |
- | + | - ADuCM3029_demo_esp8266.c: | |
- | - **MQTT** folder contains | + | - parameters.h: is the files where configurable parameters |
- | - **ADXL362.c/h** are the files for ADXL362 accelerometer control. Here you can modify: | + | - noos: is directory containing linked resources from the noos repo. Eg. Adxl362 driver, network files and platform drivers |
- | * ** Accelerometer scan interval** | + | - Mqtt client is linked as static library. Can be found in noos/libraries/mqtt |
- | * ** Sensor activity | + | - To build mqtt library run the following command in the ADuCM3029_demo_esp8266 folder: < |
- | #define INACT_VALUE | + | |
- | * ** Sensor activity and inactivity time** | + | |
- | # | + | |
- | - **ESP8266.c/ | + | |
- | * ** SSID, PASS and MQTT_SERVER** - replace with your specific data: < | + | |
- | # | + | |
- | # | + | |
- | + | ||
- | // End of Document // | + | |
+ | // End of Document// |