Skip to content

Sending MMA7455 data wirelessly using two ESP32 via ESP‐NOW

Misael.K edited this page Sep 28, 2024 · 5 revisions

https://github.com/cdrfiuba/thereminus/tree/master/esp32_espnow/espnow_sender

https://github.com/cdrfiuba/thereminus/tree/master/esp32_espnow/espnow_receiver

Sending acceleration data wirelessly using Wi-Fi

The esp32_espnow proof of concept consists of two Arduino projects: espnow_sender (for reading the MMA7455 acceleration data and sending it over ESP-NOW, wirelessly) and espnow_receiver (for receiving and printing via serial the data sent via ESP-NOW).

Sender

The sender includes the MMA7455 library for reading the acceleration data. It may be necessary to find the I2C address of your MMA7455 sensor if the one defined in the .h file. You will need to find out the MAC address of the receiver ESP32 (see the scan_i2c helper project). Reading the sensor occurs synchronously via I2C. In the setup() function, the sender initializes the sensors and turns on WiFi. In the loop() function, the sender creates a data packet (to be sent wirelessly), reads the acceleration data and loads it into the packet, and sends it to the previously defined MAC address. You can set a callback to perform an action when the data is sent.

Receiver

The receiver only needs to set up WiFi and set an espnow callback to receive the data asynchronously. It needs to know the shape of the data that the sender is sending (using the same data struct). Nothing occurs in the loop.

Helpers

Two projects are provided: scan_i2c for finding out the I2C address of your MMA7455 3AD module, and read_mac for finding out the MAC address of the ESP32.

I2C particularities

Use short cables for connecting. Follow the 3AD module reference circuit.

Extra files

MMA7455 3AD.pdf

MMA7455L.pdf

esp32-diagram