Non Contact Wireless Liquid Level Gauge

Print Friendly, PDF & Email

Data Transmission: After you are done with the sensor and its instrumentation amplifier the next step transmitting the data read by the MCU from the sensor. For the transmitter I am using a simple to use and widely available 434MHz low power transmitter. Also the sensor transmits raw adc values to the receiver. This enables calibration and scaling of the sensor data at the receiver end.

El-Cheapo ASK TX

 The 434MHz ASK transmitter and is cheap and easy to interface. However, the cheapness of price brings along with it some limitations like absence of a UART, error correction, framing of data, channel congestion/contention or to put simply, the device lacks a protocol stack.  The lack of features cannot be just glossed over and are required to be tackled. So I let the software fill in that gap and approached the problem programatically.
Since this kind of transmitters are fairly common and easy to find, it is but natural that they find common use in our day to day life. As a result for my receiver, my transmitters data transmission should stand out from the rest and should not be swamped by other transmitter. Hence I decided to use PWM modulation to encode my ones and zeros’s .

I hooked up my receiver’s data output port to an oscilloscope and found out that most of the background noise (unwanted data transmissions) had small pulse widths, so I decided  to go for large pulse widths for PWM. However a larger pulse width effectively translates into slower data transmission and also higher power consumption. But both of these did not matter much as I intended to transmit data once a minute.
The next step was to do framing of data and error detection (1 bit error detection and recovery possible but recovery not implemented). Framing of data was achieved by sending a slightly larger pulse at the start and end of data transmission and in between bytes.

I will try to explain encoding of data by an example. Assume that we want to transmit raw ADC value 512 as read by the MCU. Since the maximum possible value transmitted by the MSP MCU is 1024 (10 bit ADC), the transmitted value has four digits.

So the first step is to break the received value into 4 individual digits.
Splitting 512(0512) we get

Ones = 2
 Tens=1
 Hundreds=5
 Thousands=0 

Second thing to note that each of the individual can have a range of integer value from 0 to 9, though the thousands place can only toggle between o or 1, as value cannot be greater than 1024. Thereafter I encoded each individual bit into a 4 bit binary value, thus 0512 gets encoded as

0=0000
 5=0101
 1=0001
 2=0010

Now to give a 1 bit error detection/ correction , the resultant bit value for each digit was complemented and added to the original bit value to generate a 8 bit number. Thus each byte has a set of complementary bit value.

Digit Bit Value C’pmntd Bit Value Resulting Int
0 0000 1111 15(0001111)
5 0101 1010 90(01011010)
1 0001 1110 30(00011110)
2 0010 1101 45(00101101)

From above we can arrive at a simple formula to transmit a a digit (n) we have to transmit (15*(n+1)). Data is transmitted in multiples of 15 and thus if read value is not a multiple of 15 , Houston we have an error!

Effectively to transmit a 10 bit number we are actually going to transmit a 32 bits (8bits x 4 digits) + framing bits. This might seems to be an unnecessary overkill and yes its is, but then I wanted a simple solution to rather than a complex mathematical one like.

This entry was posted in DIY, Electronics, MSP-GCC, MSP430, Programming, Projects and tagged , , , , , , , , , , , . Bookmark the permalink.

7 Responses to Non Contact Wireless Liquid Level Gauge

  1. Dilip says:

    Hi can u give me an idea for how to manage current cuts in your home..can u suggest how to build a cheap generator or inverter to supply current for home?

  2. Wayne Byal says:

    Hi
    I am having a hard time finding a good link to your liquid level gauge project with schematics, board layout, parts list and code could you please provide this thanks wayne.

  3. Pingback: karve.in: ??????? ?? ????? | MyLinks

  4. Olá estou procurando um esquema de circuito eletrônico para nível de caixa d’água, que tenha as seguintes medidas, 25%, 50%, 75%, 100%, através de sensores por fios e que tenha visor LCD para indicação. Também quero outo esquema que mim indique 50%, 75%, 100%, através de sensores com fios e tenha visor LCD, não sei se uma placa só serve para os dois casos. se você tiver algum me envie por favor.

    Atenciosamente,
    José Elaesso da Silva.

  5. Arky says:

    Hi interest in a unit like this can you contact me at my email philarkinc@gmail.com

Leave a Reply

Your email address will not be published. Required fields are marked *