Menu

HC-05 BLUETOOTH MODULE WITH PIC

2019-01-01
2019-01-03
  • BASIL HATZILAIOS

    I would like to send data from a tablet (windows), to a device with RS232 input with a bluetooth module hc-05..I'll use a pic 8bit to setup the module....is there a GCB demo code ,or a code for pic, to helps me to change the connecting code from default1234 for bluetooth module ? about hardware, is there a need to use a pic with 2 uart or one ? to send data from module to RS232 input is there a need of a driver/receiver ic ( max232) ?

     
  • Anobium

    Anobium - 2019-01-01

    The HC-05 is a serial device. Just use RS232 (USART) from your user program to communicate with the HC-05.

    You can use the Great Cow BASIC hardware or software serial solution. Either will work.

    Not sure about MAX232 - but, I doubt it.

     
  • mmotte

    mmotte - 2019-01-01

    Basil,
    I have used the HC-05 for two way communications to data loggers from my phone many times. Very easy using 9600 baud GCB HSer routines in the PIC. First connect only required "pairing" and the '1234" pw. I used a BlueTooth serial terminal and could download the data and then email it to my home computer.

    Your application is a little different because you are using a pic as an intermediary?

    [Tablet] <-BT-> [ HC-05] <- 5v TTL serial -> [PIC] <- 5v TTL serial -> [ MAX-232] <- RS-232 +-voltage -> [Your device]

    So you destination device is at RS-232 levels and what baud? Is it an old device that requires parity? Is it a device that requites some protocol? Are your changing bauds in the PIC?

    It would be nice if the PIC had two usarts for this type of application.

    (The attached file has a problem with temperatures above 100F. I can't find the current one).

    BR
    Mike

     

    Last edit: mmotte 2019-01-01
  • BASIL HATZILAIOS

    many thanks Anobium ,
    Mike, my destination device is a typical rs232, 9600,N,1 ...no change baud in the pic....I would like to use the pic at a stand alone device for two reasons : to change the default password 1234, in AT mode , then switch to data mode , send the data from my tablet....after that turn off the power switch of pic board....I would like to set the new pw with a command at the start of the code , so when turn on the power switch, no new pairing will be required....after that, bluetooth module must be on data mode to receive/transmit data...is there a example code to do this ? the connection to destination device may be in parallel to rx, tx connection between pic and bluetooth module, or there a need for a pic with 2 uarts ?

     
  • mmotte

    mmotte - 2019-01-03

    Basil,
    I think puttting the PIC in will only complicate what you are trying to do.
    Facts to work with:
    HC-05 is 3.3vdc for interfacing as in "Set pin 34 HIGH (3.3v) to enter AT Mode"
    ATMode is at 38500 baud
    HC-05 comes up in communications mode at 9600 baud as default.
    HC-05 module says supply power can be up to 5or6 vdc but the SM module itself is 3.3vdc
    Most interfaces assume 3.3 and use resistor dividers


    " my destination device is a typical rs232, 9600,N,1" says to me that your output must use a MAX232 chip or equivalent to generate the +- 5to15vdc for rs232 .

    So you would be able to use the HC-05 and a MAX232 just by wiring them together with a few caps and a 5vdc power supply.

    [HC-05] <- 5vTTL,tx&rx -> [MAX232] <- 5vdc+- -> [Your Device]

    Yes, you would have the default name"HC-05" and default pw "1234" but it would work this way.


    To change the name and password you can use a FTDI USB interface module. They come with 5vdc or 3.3vdc output. You would use a serial terminal program set to 38500 baud and could talk to the HC-05 after jumpering pin 34 HIGH (3.3v) to enter AT Mode. I have done this method on a couple HC-05 s but after a while I just left them and used their unique MAC address numbers that would show up when paired and the terminal program would differentiate them by that way.

    [PC with term pgm] <-USB-> [USB FTDI interface] <- 3.3vdc -> [HC-05]

    There are many web sites describing how to use the HC-05 and i have no affiliation with this one but it has a lot of good info. https://www.gme.cz/data/attachments/dsh.772-148.2.pdf

    What do you think? Do you still need a PIC in your project?
    BR
    Mike

     
  • BASIL HATZILAIOS

    Mike , good idea....I'll make some tests with arduino...many thanks...

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.