Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

ultrasonic sensor SRF05
#1

Hello,
I have a well in the garden and I would like to take advantage of the weatherduino TX to transfer the water level. I use an ultrasonic sensor SRF05 which is very widespread.
Is it possible to integrate it as spudstrawb did on the thread: http://www.meteocercal.info/forum/Thread...light=case

I will not use a UV sensor, so I would like to have the well level at this location (as spudstrawb did) on the RX and WD. I do not have enough programming skills to change the code.

I will use a waterproof DS18B20 sensor to know the water T ° but this is already provided on the TX card so no worries.

Thanks


code for display on lcd 16,2 and serial. I use only %, others values are calculation. 


Code:
//HC RS04 Ultrasonic ranging module int triggerPort = 2; int echoPort = 3; #include <LiquidCrystal.h> LiquidCrystal lcd(8,9,4,5,6,7); void setup() { lcd.begin(16, 2); Serial.begin(9600); pinMode( triggerPort, OUTPUT ); pinMode( echoPort, INPUT ); } void loop() { digitalWrite(triggerPort, LOW); // set to LOW trigger's output digitalWrite(triggerPort, HIGH); // send a 10us pulse to the trigger delayMicroseconds( 10 ); digitalWrite(triggerPort, LOW); long duration = pulseIn(echoPort, HIGH); long r = 3.4 * duration / 2; // here we calculate the distance using duration float distance = r / 100.00; float pourcent = duration; Serial.print("duree: "); Serial.println(duration); Serial.print("distance: "); if( duration > 38000 ) Serial.println("out of reach"); // if duration in greather than 38ms, the obstacle is out of reach else { Serial.print(distance); Serial.print("cm  ");} pourcent = map(duration, 1000, 10500, 100, 0); //1000 pour le niveau haut et 10500 pour le niveau bas lcd.setCursor(0, 0); lcd.print("niveau:"); lcd.print(pourcent); lcd.print(" %  "); delay( 1000 ); // wait for 1s }
Reply


Messages In This Thread
ultrasonic sensor SRF05 - by f4aii - 04-03-2017, 16:48
RE: ultrasonic sensor SRF05 - by spudstrawb - 04-03-2017, 22:25
RE: ultrasonic sensor SRF05 - by AllyCat - 05-03-2017, 11:18
RE: ultrasonic sensor SRF05 - by f4aii - 05-03-2017, 20:36
RE: ultrasonic sensor SRF05 - by danner - 07-03-2017, 10:22
RE: ultrasonic sensor SRF05 - by werk_ag - 08-03-2017, 05:31



Users browsing this thread: 1 Guest(s)