HC05 and pi pico
Posted: Sat Mar 20, 2021 8:48 am
Hello everyone !
I just bought a pi pico and an HC05 for wireless communication to and from the pico.
I saw several YouTube videos where they seem to be doing things so easily, but that doesn't seem to work for me.
Pico is my first micro controller and I'm not sure what I'm doing wrong !
Connection;
hc05 vcc - vsys
tx and rx to GP0 and GP1 - tried interchanging them too !
ground - grnd
the code in Thonny:
from machine import Pin, UART
uart = UART(0, 9600)
while True:
# print('checking BT')
command = uart.readline()
print(command)
Here I get nothing, and the while loop does not repeat itself over and over. (if I uncomment the first line in the while clause, it doesn't print it over and over, but it runs only once ! if I print part.any() I get 0. Even then it doesn't run over and over in the while loop.) I don't understand what I'm doing wrong!
I saw this link to send hex from Mac to hc05 and print the send command in tonny. but it didn't work.
https://www.youtube.com/watch?v=0TzYDOIaDYA
I tried this, my android phone is a Samsung tab s6 lite. I also tried sending commands fromHC05 bluetooth controller app.
https://www.youtube.com/watch?v=vDJRMidEvhU&t=53s
I also tried to power it via an adaptor instead of the USB as I read that on usb connection the default SERIAL connection changes to bluetooth. But nothing works !
I understand that the idea is to get a string from the phone / pc to the BT module and then into the pico, with which we can control other other devices, based on the received string, write a logic like;
do this if command =='on led' or do that if command is 'something something'
any help is appreciated !
Thanks in advance !
Would be really great if you could give me a brief / guide me to a book / resource, where I can understand the communication protocols which we are using or some basics so I can interface devices without having to read online guides.
I just bought a pi pico and an HC05 for wireless communication to and from the pico.
I saw several YouTube videos where they seem to be doing things so easily, but that doesn't seem to work for me.
Pico is my first micro controller and I'm not sure what I'm doing wrong !
Connection;
hc05 vcc - vsys
tx and rx to GP0 and GP1 - tried interchanging them too !
ground - grnd
the code in Thonny:
from machine import Pin, UART
uart = UART(0, 9600)
while True:
# print('checking BT')
command = uart.readline()
print(command)
Here I get nothing, and the while loop does not repeat itself over and over. (if I uncomment the first line in the while clause, it doesn't print it over and over, but it runs only once ! if I print part.any() I get 0. Even then it doesn't run over and over in the while loop.) I don't understand what I'm doing wrong!
I saw this link to send hex from Mac to hc05 and print the send command in tonny. but it didn't work.
https://www.youtube.com/watch?v=0TzYDOIaDYA
I tried this, my android phone is a Samsung tab s6 lite. I also tried sending commands fromHC05 bluetooth controller app.
https://www.youtube.com/watch?v=vDJRMidEvhU&t=53s
I also tried to power it via an adaptor instead of the USB as I read that on usb connection the default SERIAL connection changes to bluetooth. But nothing works !
I understand that the idea is to get a string from the phone / pc to the BT module and then into the pico, with which we can control other other devices, based on the received string, write a logic like;
do this if command =='on led' or do that if command is 'something something'
any help is appreciated !
Thanks in advance !
Would be really great if you could give me a brief / guide me to a book / resource, where I can understand the communication protocols which we are using or some basics so I can interface devices without having to read online guides.