|
Teleoperated Robot Hand
|
Directories | |
| src | |
This folder holds the platform.io project for the transmitter. The main task of this project is to read the bend of the glove and transmit the data to the receiver.
In order to mimic the user's hand motions while wearing the glove, we used flex sensors that act like potentiometers. Depending on how much the user is bending the flex sensor, the resistance will increase or decrease. By creating a simple voltage divider circuit with the flex sensor and a 100 ohm resistor, we can read how the voltage is changing through ADC channels on our ESP-32.
Delving into the software, we can see the basic task architecure above. There are only 2 tasks for this project with the read sensors task running every 10ms and then sending that data over to the transmit task to then be sent to the receiver.
Each finger has its own queue when communicating between tasks, but to make the code simpler a Hand class was created. This Hand class holds all the queues and is used as a way to access each queue from the tasks.
In the read sensors task, the voltage is read from each flex sensor and published to a queue. The transmit task is constantly reading from each queue until it is empty. An average is then taken while making sure to avoid dividng by zero.
Setup for ESP-NOW is all done in the setup function before the scheduler begins. To avoid broadcasting to any ESP-32s nearby, we broadcast specifically to the MAC address of the device we want