Friday 15 May 2015

python - logging values from arduino to postgres db -


I have a temperature sensor ([LM 35] [1]) which is different with an Ardino board and mine [sketch] [2] The value in the serial port is able to log in, in Ubuntu / dev Say / ttyacm0 , and I was able to install the pyasial and log the temperature values ​​in a file ... I used the command
  python-serial.tools .miniterm / dev / ttyACM0 & gt; & Gt; Templogger.csv   

Then it will log the values ​​in the templogger.csv file such as

  27 28 27   

.

Rather than logging in to CSV file, can I log these values ​​directly to the postcode database, tell DB1 with username 'ABC' and password 'XYZ'. Is it possible through Python, can you please help by providing the necessary script

Start with, which implements the Dragon Database API.

You may want to start with simple person INSERT s, but later you will be able to work in a batch transaction or use COPY

If you are stuck on something then it is OK to ask for help, but it is better that you try to understand it first. If you have more questions then you will get better results: "I have tried to use psycopg2 to connect my Python program to PostGrace SQL, so I can write sensor logging to the database, but when I INSERT a I have not received any help in searching for error message, so I got stuck. "

In other words, try it out, and if you get stuck Are you Ask me, I usually stop such a question as "very local" or "not real question", which gives you an automatic link to write questions, but you are new here and you have a An attempt to write decent questions, therefore, I am trying to explain in a little more detail.

No comments:

Post a Comment