1

For example here is a simple message in binary that I want to send via ultrasound:

Bit Stuffing 
12 Byte Message (3 Time Stamps) 
Bit Stuffing

01010101 
10100001 00101110 01011001 00101110 
10100001 00101110 01011001 00101110 
10100001 00101110 01011001 00101110  
01010101

Lets say we use 30kHz ultrasound at a sampling rate of 120kHz. Idealized the sound would look like this right ?

enter image description here

To realize this what one can do is just set a GPIO on the Pi to HIGH when sending a 1 and to LOW when sending a 0. But how do you do this at a constant specific frequency, so that you can just split the measured values into 33,3us windows where you just check if it was a 1 or a 0 ?

enter image description here

le_lemon
  • 107
  • 1
  • 11
  • Is going negative mandatory? If so it is quite a bit complication. Raspberry Pi (and most other SBCs and MCUs) can do only 0 or +3.3/5V. Going -3.3/5V require additional electronics (logic gates, comparators, stuff like that) and additional logic as well. Please describe operation of your ultrasound transceiver and purpose of the device. – Grzegorz Pudłowski Jun 10 '20 at 15:46
  • No, the diagramm is a bit misleading. What I meant there is how the sound would look like, not how the output of the PI would look like. The Output of the Pi is just a change between the two constant voltages of 0V and +3,3V. I added a small drawing of how I imagine driving the small speaker. – le_lemon Jun 11 '20 at 09:33
  • How, and with what, are you hoping to receive the message please? And over what distance? – Mark Setchell Jun 11 '20 at 10:46
  • OK now it's clear. In my opinion programming this in C is the way to go because of relatively high frequency. Python RPi.GPIO library can do about 70kHz though so may be worth to try. But if it has to be reliable communication then try C native library. It gives you more controll over the hardware. If you need wrap it into some easy to digest user interface then you can call C binaries from Python. Sorry for no definitive answer. Topic is too broad to give a tip working for you tomorrow. – Grzegorz Pudłowski Jun 11 '20 at 12:34
  • @MarkSetchell 1. a similar setup but mirrored. If you think I will need a different setup pls let me know 2. the distance is between 0.5m & 5m with a typical distance of 2m – le_lemon Jun 11 '20 at 14:18
  • Any reason not to use Bluetooth or ad-hoc WiFi? – Mark Setchell Jun 11 '20 at 14:24
  • @MarkSetchell I will try other media than ultrasound later in the project and compare them. One reason could be that I have almost no overhead. – le_lemon Jun 11 '20 at 14:39

0 Answers0