-
Notifications
You must be signed in to change notification settings - Fork 0
Sending MMA7455 data wirelessly using two ESP32 via ESP‐NOW
https://github.com/cdrfiuba/thereminus/tree/master/esp32_espnow/espnow_sender
https://github.com/cdrfiuba/thereminus/tree/master/esp32_espnow/espnow_receiver
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).
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.
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.
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.
Use short cables for connecting. Follow the 3AD module reference circuit.