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 :)
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
Is it possible? Python send Hex code via usb port (raspberry pi)