TREASURE HUNT USING ESP32 (BLE SCANNER)
The treasure hunt makes use of ESP32, OLED, and buzzer modules. ESP32 has been specifically chosen due to its BLE functionality and OLED being one of the more simpler displays. Let us see how we can organize a treasure hunt using these components.
How does the treasure hunt happen?
- First of all, we need at least 2 ESP devices to have a treasure hunt
- One will broadcast a BLE Server and the other one will act as a scanner; it will make a sound using a buzzer when it comes close to the first device
- All you have to do is carry the second one around and find answers to the hints by moving towards the area where the frequency of beeps from the buzzer increases
- The first device will be throwing a BLE Server and will be kept somewhere near to the solution of the clue.
- Once you find this device, the next clue will be displayed on the OLED screen
- You have to keep doing this to move onto the next stage of the treasure hunt
- Note that we’ll need several devices depending on the number of players and clues; one scanner for each player and one server for each clue
Server & Client Flow
After getting a hold about the treasure hunt, let’s go through the program flow of the devices being used during the hunt.
- As mentioned above, 2 types of devices are being used: one acting as a BLE Server and the other as a BLE client
- The BLE server device advertises a server while the other device, known as the client, scans for that server
- The client has been programmed to look for our treasure hunt server and produce a sound when located in proximity to the server
- RSSI is used as a measure for the proximity of the client to the server
- Refer to the flowchart below to have an in-depth idea about the program flow of each device
Circuit for the Client & Server
Make the connections shown below to make the circuit for client and server. The buzzer connected to the ESP will produce a sound when you are near to the location of a clue by scanning for the server. In order to make your hunt more fun, you can hide the server making it hard for people to find.
Fig. 1 -Client Fig. 2 - Server
Now let us see the whole setup in full action. The following video will show you the working of the BLE scanner and demonstrate the idea of planning your own treasure hunt using ESP32.
Maybe unlike us, you can put the servers inside Easter eggs while planning your hunt.
Link for the Programs:
Download the code from our GitHub page and upload it to your ESPs to get started with your hunt: https://github.com/Robocraze/BLE-Scanner
Here are some fun facts about Bluetooth Low Energy (BLE). BLE is a power-conserving variant of Bluetooth. Unlike Bluetooth that is always on, BLE remains in sleep mode constantly except for when a connection is initiated. This makes it consume very low power, approximately 100x less than that consumed by Bluetooth. Additionally, BLE supports not only point-to-point communication, but also broadcast mode, and mesh network. BLE has great application in healthcare, fitness, tracking, beacons, security, and home automation industries.
ESP32 makes the implementation of these recent technologies such as BLE so easy. We hope you also think of similar applications and make your learning process more exciting.
Wishing you a happy and joyous Easter. Hope you have a blast solving clues and finding treasures.
Buy ESP32 Here
Buy Bluetooth Module