-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
could not connect to the database server #1
Comments
Hello, I have installed everything, I can see the dashboard. But I don't think the sql DB is receiving data. If I launch the sensor.py script, I get the following output:
But nothing happens and don't see any data. I also have set a cron job. What did I miss? Regards, lls |
In sensor.py
replace this:* from urllib.request import urlopen*
with this :* from urllib import urlopen*
just go in steps
first try to send some dummy data to server. See if that in getting stored
in database. For that you can replace
distance=get_distance()
with
distance = 32
and see if the value 32 is getting communicated to the server and stored in
the database.
Ensure that you have created the database named 'level_log' and imported
the file 'water_level.sql' in it.
The credentials in file 'db_params_wt.php' should be correct other wise you
will keep getting that error message
Once that is done, try to get the value from the ultrasonic sensor by
checking the hardware connections.
then, replace the dummy data with the sensor value
…On Sun, Aug 1, 2021 at 11:49 PM Lorenzo ***@***.***> wrote:
Hello, I have installed everything, I can see the dashboard. But I don't
think the sql DB is receiving data. If I launch the sensor.py script, I get
the following output:
***@***.***:~ $ python3 sensor.py
sensor.py:17: RuntimeWarning: This channel is already in use, continuing anyway. Use GPIO.setwarnings(False) to disable warnings.
GPIO.setup(TRIG,GPIO.OUT)
sensor.py:21: RuntimeWarning: This channel is already in use, continuing anyway. Use GPIO.setwarnings(False) to disable warnings.
GPIO.setup(ALARM,GPIO.OUT)
Waiting For Sensor To Settle
But nothing happens and don't see any data. I also have set a cron job.
What did I miss?
Regards,
lls
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#1 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AK7U6FTDTDCCX4JCIAB4XADT2WF2DANCNFSM47XIU2DA>
.
|
Hello everybody! now it works, I followed @jiteshsaini post! |
Dear Jitesh, thank you for the advice. I am still having some trouble.
When I run the script, I get the following error:
Please note that I am using a different sensor, but connected to the same GPIO pin (5 and 6) Here is the material I am using: The ultrasonic sensor The sensor was tested successfully with another python script with connection to UART. But I would like to use it with your script to use the cool dashboard that you have shared. What should I do? |
Oh, I understand my mistake now. I was just not using the wright IP in the URL address. Great! |
So, it worked with With the command python3 sensor.py I get: And the same result with python2 sensor.py and from urllib import urlopen I think I am almost there, how I can I resolve this? ** EDIT ** OK, now I understand. I changed the TRIG/ECHO numbers in the sensor.py script and now it is working. Great project and fun to implement. Thank you. |
I apologise for multiple posting. Is there something I should calibrate in the py or PHP scripts? The values I get does not correspond to the reality. Also, could you please explain the output of the command
Thank you. |
Instead of taking 1 reading, the code takes 20 readings at a gap of 100 ms. Then calculates the average of these 20 readings. If any of these readings are above the max height of the tank, which in my case is 125, then it rejects those values as they certainly are erroneous values. This clearly indicates that either the sensor is not interfaced correctly or it is faulty. Change the sensor and try. No need to calibrate any py or php script |
Mmmh, I am strugling with the python code. I have a sensor which is different than the one you have used. I connect it to a board connected to a RPi to UART. I like it because it is waterproof and it does not require the 1k/2k resistors. That would be perfect for my project. It works well with a simple script I have, but gives totaly strange values with the script that you have provided. What would it take to adjust my script to send the data to the DB? Is this something you could help me with? Does the script below makes sense to you? mysensor.py
DFRobot_RaspberryPi_A02YYUW.py
|
Hello! congratulations for your project, I want to use it to measure the water level present in my tank in my company. I tried to install everything as you wrote, but unfortunately I get this error message .. I think the problem is the no connection between MySql and your Python script. Do you have any idea? I noticed that you entered the password "xyz", but I don't know where to enter it in MyPhpAdmin ..
Thanks for your help!
This is my error:
The text was updated successfully, but these errors were encountered: