Introduction: UChip - BEEP Sonar Sensor With Bluetooth Data Transmission
Recently, I developed a BEEP like a car sonar and a Serial Bluetooth to USB adapter using uChip. Each project was quite interesting on its own, but...would it be possible to merge them and create a “BT remote transmission BEEP like a car” sensor?!?
The answer is YES (what would be the reason in writing an Instructables otherwise! :) ) and this quick tutorial will show you how.
Making this project you will get a device that measures the distance using an ultrasonic sonar, generates an acoustic signal proportional to the distance and transmits the distance via Bluetooth to your phone/computer/device.
Bill of materials:
- BEEP like a car device: make your own
- SerialBT-to-USB adapter: here how to make it
- Li-ion Battery (or equivalent pack): any battery with voltage between 3V3 and 5V
Step 1: Wiring
I’ll suppose you already built your own BEEP like a car device and BT-to-USB serial adapter. In case you had not, here are the instructions:
There is no real wiring to make this project; you simply need to solder the battery connector to the BEEP like a car board in order to provide external power supply (in the previous tutorial I powered the board through the micro-USB connector).
In case you need some help with the connections, I provided the schematic from the “BEEP like a car!” with the necessary changes highlighted.
Step 2: Programming
Load the sketch “BeepLikeACarWithBT.ino” into uChip using the Arduino IDE.
Have a look at the code if you like. The code is (in my opinion) quite simple, it is possible to further optimize it by changing the frequency and priority with which the serial port transmits data. However, the optimization is out of this project scope.
Set the various #define accordingly to your needs. As default, the minimum distance is 200 mm while the maximum is 2500 mm. Furthermore, you are more than welcome to modify the BUZZ_DIV define in order to change the frequency with which the beep occurs.
Step 3: Connect the SerialBT-to-USB Converter, the Battery and Your Phone
Connect the BT-to-USB converter to uChipusing an OTG converter, attach the battery to your board and then use a BT serial terminal on your phone to bind with the BT device.
Step 4: Have Fun!
There you are! Everything is set, now you should start receiving the measured distance on your phone.
I integrated mine on the top of my old toy RC car!
Try it out and verify what the maximum range you could measure is. Mind that the device might transmit wrong data in case you are measuring the distance of “infinitely far” obstacles. You need to handle those data properly in case you want to use them for some purposes other than simple visualization.