0

Hi every one but first let me say sorry about my english. I hope you guys will understand what I mean :)


Question :

Is it possible that RaspberryPi with RASPBIAN OS can communicates with PZEM-004T Energy monitor via USB port. I want to use Python to send Hexadecimal Code to request such as voltage, current, power and energy then read data that reply from module(PZEM-004T) and keep it into phpMyadmin.


For example


If I send hex command code : B1 C0 A8 01 01 00 1B, module will replys data back : A1 00 11 20 00 00 D2. Then convert replied data to decimal and keep it into database.

please suggest me what is the best way to success this challenge :)

Nothingnez
  • 183
  • 1
  • 2
  • 14
  • Yes, it is possible with a library such as `pyserial`. Look at this answer: http://stackoverflow.com/questions/15570526/sending-hex-over-serial-with-python – Leon Z. Feb 23 '17 at 18:47

1 Answers1

0

Yes you can do this by using libraries such as pyserial like Leon said for the serial communication.

For the SQL database, you can use sqlalchemy to manage it.

This module (PZEM-004T) uses TTL serial communication, so if yours is not selled with an USB adapter you need one like a FTDI232 based one for example.

I don't know what your program is intended for, but as it's a datalogger, if you want it to run every time your raspberry pi reboot you can call it in your /etc/rc.local

Elominp
  • 59
  • 5