
Limited Time Download: Reply “Tutorial” to get the microcontroller e-book, reply “Simulation“ to get Proteus simulation materials, Baido cloud group share link update time: 2016-04-8, if expired, please leave a message at the end of the article, do not leave a message in the background, if there are no files, please privately chat with the group owner of the Baido group you joined, for some reason, sometimes shared files will be canceled by Baido!
First of all, this is a very simple small experiment, which is a small part of the project I am currently working on, but I still hope to share it, looking forward to seeing colleagues or enthusiasts communicate or critique with me.
The water level sensor I used is this, link: http://dwz.cn/5K0UTN
It is relatively cheap, one dollar each, but being cheap also has its shortcomings, because the measurement range is too small. I measured it with a ruler, and the deepest can only measure 4cm. However, it is small in size and lightweight, and can be DIY and customized according to needs, making it quite flexible to use. Let’s talk about the wiring. The water level sensor has three universal connections, one connected to VCC, one connected to GND, and the analog output terminal connected to any analog input port of the Arduino. I used the A0 port, as shown in the figure below: The code is as follows:
double temp, data;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
temp=(long)analogRead(0);
data=(temp/650)*4;
Serial.print(“the depth is:”);
Serial.print(data);
Serial.println(“cm”);
delay(1000);
}
Insert the parallel wires of the sensor vertically into the water surface, as shown in the figure
You can see the following data in the serial monitor:
Source: http://blog.csdn.net/song527730241/article/details/50897997 Click to read the original article to enter the author’s blog
Limited Time Download: Reply “Tutorial” to get the microcontroller e-book, reply “Simulation” to get Proteus simulation materials.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >
Click the lower left corner “Read the Original“, to enterForum Communication!!!