• Home
  • pcDuino
  • WiKi
  • Store
  • Distributors
  • Home
  • pcDuino
  • WiKi
  • Store
  • Distributors
HomepcDuinoArduino-ish ProgramADCUse Liquid Level Sensor on pcDuino
Previous Next

Use Liquid Level Sensor on pcDuino

Posted by: admin , March 21, 2014

[vc_row][vc_column width=”1/1″][vc_tour][vc_tab title=”Introduction” tab_id=”1395366544-1-66″][vc_column_text]QQ图片20140318154209

PCB based liquid level sensor module is a module that could detect the liquid level. The core part is an amplified circuit which consists of a transistor and a comb PCB trace. The resistance of the comb PCB trace will change with the liquid level, so that it could convert the level signal into the electrical signal, and then we can read this voltage signal using the ADC of [bigcommerce link=”/pcduino-v2-an-minipc-with-arduino-headers-ubuntu-android-google/” target=”_blank”]pcDuino [/bigcommerce].[/vc_column_text][/vc_tab][vc_tab title=”Parts List” tab_id=”1395366544-2-96″][vc_column_text]The whole setup is shown below:
QQ图片20140320173537

Wiring Diagram:

  1. Power(+) of liquid level sensor module – > 3.3V of pcDuino
  2. GND(-) 0f liquid level sensor module – >  GND of  pcDuino
  3. The output signal (S) – > analog signal input port (A0-A5)  on the pcDuino, any port of A0-A5 ( recommend  A2-A5, because the accuracy of A0, A1 has only 6 bits, and may not see the significant changes). Please make sure to connect the same port as what is used in the code.

[/vc_column_text][/vc_tab][vc_tab title=”Test Code” tab_id=”1395366785175-2-4″][vc_column_text]

#include <core.h>
int adc_id = 2;
int delay_us = 100000;
int HistoryValue = 0;

void setup()
{

}

void loop()
{
    int value = analogRead(adc_id); // get adc value

    if(((HistoryValue>=value) && ((HistoryValue - value) > 10)) || ((HistoryValue<value) && ((value - HistoryValue) > 10)))
       printf("ADC%d level is %dn",adc_id, value);
    HistoryValue = value;
    delayMicroseconds(delay_us);  
}

[/vc_column_text][/vc_tab][vc_tab title=”Test Result” tab_id=”1395366785957-3-0″][vc_column_text]

QQ图片20140320173140QQ图片20140320173605

 

[/vc_column_text][/vc_tab][/vc_tour][/vc_column][/vc_row]

Tags: ADC

Share!
Tweet

admin

About the author

Leave a Reply Cancel reply

You must be logged in to post a comment.

Category

  • Home
  • pcDuino
  • WiKi
  • Store
  • Distributors