I am searching for a way to send data from raspberry pi to my AVR using HM10 or HC05, both of which are available. What I need to do is to read values from a .txt file and send it from the raspberry pi to the AVR, and it should do so every 2 minutes. I am done with the AVR part, but I am having trouble with the Rpi part. Can anybody help, please?
How can Rpi send text strings to HC05?
I once wrote a couple of python functions to do the following:
Reset HC05 to AT command mode,
Reset HC05 to connection mode,
Write AT command to HC05,
Read reply from HC05.
With these set of basic functions, I can then do the following.
Set HC05 to AT command mode
Send AT commands to HC05 to config it.
Set HC05 to connection mode.
Scan HC05 for connection status.
When the HC05 is connected, then Rpi can send text string to it, also reading reply if necessary. If you can send AT command, then of course you can send text using python data type "bytes".
There are some more functions I wrote, like power resetting HC05 (controlling a power supply to hardware reset HC05， wait HC05 operation delay (important).
I then wrote more functions to control 4 HC05s. There are about 20 AT commands to process, Reset, Version, Addr, Name, Role, Password, State, Cmode, LinkAddr, ... etc. So it is a tedious job, taking me perhaps two hobbyist weeks. It is annoying to find that different vendors have different init conditions such as baud rates for HC05/06. These inconsistencies wasted me a lot of time finding out.
I know there are libraries and example programs, but most are for Arduino, and they are not flexible. So I wrote my own functions. All the functions and testing code is about 360 lines.
I know the basic things about AT/OK (sort of Hello Word) etc very well, and I use a powerful terminal emulator called SuperTerm to do the debugging. I also have a US$300 4 channel digital storage oscilloscope to do hardware troubleshooting.
If you don't have similar background, knowledge, skills and equipment, it might take you much longer to complete the project.