Week_10_Documentation & Reflection
Junxian Chen - Sun 21 June 2020, 12:49 pm
Modified: Sun 21 June 2020, 12:49 pm
Further research by Wireless
In the process of understanding and using wireless transmitter (NRF24L01), I found that wireless transmitter has good signal stability, wireless transmitter will accurately transmit data, so there will only be two cases that can be: received and not received.
In the process of using wireless transmitters, a pair of wireless transmitters defaults to one being a signal transmitter, and the other is a signal receiving device. They are all based on the support of https://github.com/nRF24/RF24 library. In the process of transmitting, both wireless transmitters can use radio.read() to read the signal, but only one of them can use radio.write() to send. This is because NRF24L01 cannot receive the signal while sending the signal. In order to solve this problem, after searching for relevant information, I decided to use radio.writeAckPayload() to achieve two-way communication. And use a set of signal interaction mechanisms based on only sending special command signals.
First of all, the base station and the bracelet perform signal transmissions by default. This interaction is called "Basic interaction". The role of this transmissions is to confirm that the base station and the bracelet are within the range of the interactive signal. The specific manifestation of "Basic interaction" is that every 1/4 second, the base station sends a "request signal" to the bracelet. After receiving the "request signal" from the base station, the bracelet will reply a "reply signal" to the base station, thus completing a loop.
On the basis of "basic interaction", in order to execute other commands, I need to send a "special signals" other than the "basic interaction" signal. However, I ran into another problem, because in order to achieve "basic interaction" function, the signal transmission of the base station and the bracelet is set to a certain frequency (for example, the base station sends a signal every 1/4 second). In this case, if I only send the "special signal" once, it may be encountered a situation in which the command to send a "special signal" conflicted with the signal sent by the base station, which caused the base station to fail to send a signal.
In order to solve this problem, I decided to use a "reply-acknowledge" mechanism to try solve this. The base station will continue to send a "special signal" to the bracelet. Only when the base station receives the "special reply signal" from the bracelet, the base station will stop. However, this mechanism cannot be implemented in the end, the main reason is that when the base station sends a signal, it will occupy all the operating functions of the wireless transmitter, which causes the base station to not receive the signal at this time. In this kind of In this case, I can only try other ways to complete the interaction.
In the next attempt, I realized that the current problem is mainly that a single "special signal" sent by the base station may be blocked. So, I tried another method, that is, to set up a small loop, let the "special signal" is sent repeatedly 100 times in a short time. In this case, the base station will not be shielded from the signal sent in a single pass. Thus, the function is completely realized.
Prototype 1 complete realization of basic functions
After fully implementing all the functions of the wireless transmitter, all the basic functions of my product in the current Prototype are also fully realized.
- The buzzer will alarm after the timing is over; the buzzer will stop alarm after the bracelet leaves the range; the buzzer will re-alarm when the bracelet attempts to re-enter the range again; the buzzer will stop the alarm completely after the bracelet stays outside the signal range for a period of time.
- The buzzer alarm indicator light goes on when the buzzer alarms and goes off when the buzzer stops alarming.
- The chronograph indicator light is green after the chronograph starts; it turns yellow when it reaches about 50% of the countdown, and turns red when it reaches about 10% of the countdown.
- After pressing the pressure sensor on the bracelet, the bracelet and the base station will start counting.
- After the timing starts, the LED indicator on the bracelet will display as normal status.
- After the timing is over, the LED indicator on the bracelet will display an alarm state, and at the same time, the mini motor on the bracelet will start to vibrate.
- After leaving the signal range, the LED indicator on the bracelet will show the cooldown state, and at the same time, the mini motor on the bracelet will stop vibration.
- After re-entering the signal range, the LED indicator on the bracelet will enter the alarm state again, and at the same time, the mini motor on the bracelet will start to vibrate.
- After the bracelet stays outside the signal range for a period of time, the LED indicator on the bracelet will return to the normal state.
- Press the pressure sensor on the bracelet again to start a new round of timing.