0

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?

1 Answers1

1

Question

How can Rpi send text strings to HC05?

Answer

I once wrote a couple of python functions to do the following:

  1. Reset HC05 to AT command mode,

  2. Reset HC05 to connection mode,

  3. Write AT command to HC05,

  4. Read reply from HC05.

With these set of basic functions, I can then do the following.

  1. Set HC05 to AT command mode

  2. Send AT commands to HC05 to config it.

  3. Set HC05 to connection mode.

  4. 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.

References

Moving from HC05 to HM10 Bluetooth module - Mogaraghu 2016sep30

tlfong01
  • 4,665
  • 3
  • 10
  • 24
  • 3
    Pardon me, perhaps I'm missing something, but the OP's "headline" question was how to send data over Bluetooth. I don't see any aspect of Bluetooth addressed in your answer - what am I missing? – Seamus May 13 '19 at 17:11
  • 1
    I am confused. HC05 is actually a BlueTooth thing. The OP wants to use either HC10 or HC05, so I use the most common and simplest HC05 as an example. It was more than a couple of years ago when I played HC05/06 etc. Everybody now is talking BLE. I don't know nothing about BLE, because they are too expensive for a poor hobbyist like me. Anyway, perhaps it is time to refresh my memory and save more money to learn new things like BLE. – tlfong01 May 14 '19 at 01:48
  • 1
    @Seamus Those HC devices look more or less like UARTs on both ends, with the OTA link using Bluetooth or 433MHz radio. The endpoint software doesn't even have to know it's Bluetooth. – Dmitry Grigoryev May 11 '21 at 07:38