Bluetooth + WS2812 LED's



  • JonnyMac wrote: »
    There are some BLE models that provide a standard UART interface; I experimented with one a couple years ago but do not remember the part number.
    I have a HM-19 module which does BLE. Unfortunately, it uses the clunky AT interface and doesn't have many functions. I guess I need to find a device with BLE that has a programmable processor on board.

  • still nothing :(
    is the led on the module supposed to be doing a fast red blink?
  • JBWolfJBWolf Posts: 366
    edited 2020-07-31 - 00:54:34
    K documentation for the module says a fast red blink means it is waiting for pairing and will go solid when a connection is established.
    So for some reason the AT command is not going through.
    I see the configurator sends via fullduplexserial the AT command by sending an A first, then the T, rather than a single AT which cannot be done using the btio.tx command... is this the only way?

    I have tried switching pins, tested wires, tried both 3.3v and 5v power but still get module not found error.
    one thing I notice that seems weird... when I set the TX/RX pins in the configurator, with TX pin on module set to RX in code, the wait time between bauds are 1sec as expected... but when I swap, it rolls through all bauds in about 1 second.

    is there by chance supposed to be like a 1k resistor between module and prop pins?
    or is the CE pin supposed to be used? what am i missing?
  • JonnyMacJonnyMac Posts: 6,818
    edited 2020-07-31 - 01:47:20
    Shot-gunning is not the best approach to problem solving. I understand that we get desperate and will often "just try something" -- this frequently breaks parts. Approach things methodically.

    You don't want the module connected to another device while you're configuring. The configuration process lets you set the device name and PIN.

    The BT IO signals are at 3.3v; every BT module I have uses a 3.3v regulator so you can power with 5v. You shouldn't need a resistor.

    The modules I have don't have a CE pin; you'll need to do some research on this and you may have to add a control line to the configurator code.

    I dug up a module and connected to a Propeller -- it worked the first time. The delay between baud rate checks is about 1 second.
    765 x 809 - 27K
  • JBWolfJBWolf Posts: 366
    edited 2020-07-31 - 01:18:10
    I have run out of approaches...
    the jm_hc-06_configurator__17-03-21.spin code is unchanged except for the RX2 & TX2 pin values.
    RX2 is set to the physical TX pin on the HC06 module, which is directly connected with no resistor.. ditto for TX2/RX
    HC06 module is connected to 5v
    terminal rolls through each baud and returns error cannot connect

    I have tried different pins on prop, tested wires, disconnected all other devices from prop and power.
    The connect passcode of 1234 gets entered after connecting right?
    I could really use an idea
  • I just remembered something. I connect to a board that has 10K pull-ups on the IO that I use for the BT module. I remember trying the BT module on a board without pull-ups and having problems.

    Put a 10K resistor between the RX pin on the Propeller side and 3.3V. You don't need it on the TX pin because the Propeller drives that high.

    What may be happening is that the module is using an open-collector output so that it's safe for 5v and 3.3v systems -- OC connections requires a pull-up on the receiver side. I bet this will help.
  • still no luck with 10k's, tried on both lines and on each independently.
    new module ordered, guess ill have to wait a week for new one to arrive so i can confirm this one is bad
  • ok just received the new module, hooked it up exactly as supposed to be.
    tried without 10k pullup then with.
    I am still getting the exact same problem... module not found
    I'm at a complete loss here

    if youd like I can post pics of wiring
  • Sorry to be so basic, but are you connecting the Propeller TX pin to the RX pin on the BT module, and vice-versa?
  • JBWolfJBWolf Posts: 366
    edited 2020-08-04 - 03:21:43
    ok so to be 100% transparent... here is the exact files with the last pin config and pics of both normal and 10k pull-up wiring.
    Ive used this prop board with several other recent projects with no problems, it does display the baud test routine fine then displays "Error: Could not connect to Bluetooth module".
    The board on the left is a new HC05 module with RX on P14 (prop TX), and module TX on P15 (prop RX)... power on 3.3v... tried with and without 10k pull-up resistor on 3.3v+
    The board on the right is an HC06 module with RX on P16 (prop TX), and module TX on P17 (prop RX)... power on 3.3v... tried with and without 10k pull-up resistor on 3.3v+
    3024 x 4032 - 3M
    3024 x 4032 - 3M
  • JBWolfJBWolf Posts: 366
    edited 2020-08-04 - 03:35:28
    I have also tried the HC06 on 5v, with and without 10k pull-up on 5v.
    Code has been tried with rx/tx on both module tx/rx lines (direct and swapped)
    I have also tried on other prop pins as well just to make sure, also tested wires and even changed out wires just for double redundancy
    resistors have been checked on meter to make sure at 10k despite color code
  • JonnyMacJonnyMac Posts: 6,818
    edited 2020-08-04 - 03:38:00
    As has been pointed out, the HC-05 and HC-06 behave differently. The configurator program you're using is for the HC-06. You don't need this tool for the HC-05, a simple serial bridge will do.
  • so the hc06 could be bad and the program doesnt work with an hc05?
  • I have a program which assists in setting up the HC-05. I'll find it tomorrow and post some instructions to go with it.

    The HC-05 should be in by default should work without any configuration. You just have to use the default baud. I think the default is 9600 but I'm not sure.

    It may be useful to have photos of both boards front and back. The carrier boards are not all the same. IIRC, some need to be modified to allow the Propeller to change the baud of the device. It can depend on how the buttons are configured.
  • Hi

    I couldn't see any decoupling capacitors.
    I presume that yellow component next to the reset pins is a capacitor for the reset?
    Especially important close to cpu.
    Also wouldn't harm to have some bulk decoupling on bluetooth modules.

  • HC05 is on the left, HC06 on the right.
    The prop wiring is setup exactly as illustrated in the PE kit... except I've omitted the LM2940 as I have a 5v source.
    The little yellow capacitors are for the 3.3v pins on the prop, not for the reset.

    for the bluetooth modules, im just running wires directly to prop pins and 3.3v
    3024 x 4032 - 2M
    3024 x 4032 - 2M
  • Duane DegnDuane Degn Posts: 10,136
    edited 2020-08-06 - 03:12:02
    My program assumes the Propeller can control the enable (aka key) pin. On many of those small boards, the enable pin is tied to a button rather than directly to the "enable" pin on the header.

    There are a couple different ways you could try the code attached to this post. The first way is to power the HC-05 with 5V and connect the RXD, TXD and ENABLE pins to pins 0, 1 and 2 on the Propeller (or change the code to use different IO pins). Remember the the TX on the Bluetooth is the RX on the Propeller.

    The modules you have include a 3.3V regulator so you need to power the modules with at least 3.6V. 5V should be fine. I modified my board to use 3.3V but this requires a bit of soldering.

    If the above doesn't work, try pressing the button right before you start the program.

    Once you get the program working, you should be able to type AT commands into the terminal and receive replies from the module on the terminal.

    If neither of the two above directions work, you might want to try modifying the module to bypass the button. I'll take some photos of the board I use so you can see what I did. I'll try to post these photos today.

    Here's the output from when I ran the attached code. As you can see, the program tries to figure out the modules current baud setting.
    programName = BluetoothBridgeHc05_200804a
    HC-05 Test Program.
    Searching for present Bluetooth baud.
    Attempt # 1 of 6. Using baud  9600.
    Setting P2 high to use programming mode.
    Sending "AT" commands and checking for "OK" in return.
    Sending "AT" command # 1 of 4.
    Watching for the characters "OK" from the Bluetooth module.
    Characters not found.
    No Bluetooth yet.
    Sending "AT" command # 2 of 4.
    Watching for the characters "OK" from the Bluetooth module.
    Characters not found.
    No Bluetooth yet.
    Sending "AT" command # 3 of 4.
    Watching for the characters "OK" from the Bluetooth module.
    Characters not found.
    No Bluetooth yet.
    Sending "AT" command # 4 of 4.
    Watching for the characters "OK" from the Bluetooth module.
    Characters not found.
    No Bluetooth yet.
    Setting P2 low to exit programming mode.
    Attempt # 2 of 6. Using baud  115200.
    Setting P2 high to use programming mode.
    Sending "AT" commands and checking for "OK" in return.
    Sending "AT" command # 1 of 4.
    Watching for the characters "OK" from the Bluetooth module.
    BT character received = O
    BT character received = K
    The characters "OK" have been received.
    Flush extra characters.<$0D><$0A>
    Bluetooth found.
    Setting P2 low to exit programming mode.
    The Bluetooth module was found. It uses a baud setting of 115200.
    Whatever you type (with a few exceptions) will be passed to the Bluetooth module.
    The text is only transmitted to the module when a carriage return is detected.
    A line feed character is added to the message.
    The HC-05 can be placed into programming mode by setting the KEY pin high.
    To set the KEY pin high press the "|" character (without pressing enter).
    To set the KEY pin low press the "\" character.
    If the baud is changed with an AT command, then you'll need to change the baud
    used by the Propeller by pressing the "&" key.
    After commands have been issued, set the KEY pin low to use the module as normal.
  • Here are the mods I did to one of my HC-05 boards (at least I think it's a HC-05 board).

    If you connect the power pin to the 3.3V line like this you need to make sure you don't connect the board to 5V.

    I don't remember why I soldered the enable/key line to three different pads. I think the KEY line is on different pad numbers depending on the specific module. I think I had a PCB which could use multiple different modules and I just used these multiple pads rather than checking the datasheet for the specific module. IIRC, connecting the the additional pads didn't cause a problem.


    I don't think the above changes are necessary to use the module with the Propeller. These changes just made it easier for me to test the module without a need for a 5V power source.
    1821 x 1213 - 514K
  • Hi Duane, can you try re-attaching the code... its not on the post
  • JBWolf wrote: »
    Hi Duane, can you try re-attaching the code... its not on the post

    That's odd. I remember navigating to the file to attach it. I edited my earlier reply to attach it. It should be there now.
Sign In or Register to comment.