Shop OBEX P1 Docs P2 Docs Learn Events
How to use those cheap Bluetooth modules with the Prop (and more) — Parallax Forums

How to use those cheap Bluetooth modules with the Prop (and more)

Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
edited 2015-06-17 16:31 in Propeller 1
I've been playing with those cheap Bluetooth modules (All kinds of them on Ebay under $15.00)
The catch with these is that they are cheap from China, but it takes some digging to get the documentation straight.

Hopefully, this project will save some folks some of the time and frustration I've gone through, as they are cheap, and easy to use serial devices which will provide good short range communication with the Propeller. To top it off, I've added an Introduction to Just Basic for creating a snazzy interface on the PC to control your Propeller projects.

Here's the link:
http://www.gadgetgangster.com/news/56-jeffs-shop/534-bluetooth-howto.html
«1

Comments

  • Martin_HMartin_H Posts: 4,051
    edited 2012-05-02 17:01
    Good tutorial. Have you figured out the AT commands to set the baud rate for the module rather than use the default of 9600?
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2012-05-02 17:04
    Martin_H wrote: »
    Good tutorial. Have you figured out the AT commands to set the baud rate for the module rather than use the default of 9600?

    I have some notes on that here that I can dig out, but it wasn't really a big item for the article. Spent a lot of time figuring out how to get proper communication settings between the Propeller and the module. Hopefully, that will be remedied with this.
  • RaymanRayman Posts: 14,651
    edited 2012-05-02 17:48
    Very nice. I see them on Ebay for $8.60, that's pretty cheap... Thanks, OBC.
    This does look like the lowest cost path to wireless (if your laptop or PC already has Bluetooth).
  • Cluso99Cluso99 Posts: 18,069
    edited 2012-05-02 19:48
    Nice job OBC!
    phishguy - nice find!

    Beats wasting 3-4 cogs and a $1 Bluetooth although smaller.

    Now we just need a similar priced wifi version :)
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2012-05-02 22:21
    The trouble with the $6.60 ons is that they are still a SMD module whereas the other ones are mounted onto a carrier so that so can be plugged in using the 4 pin header. I ordered 6 of these 4-pin versions to play with.
    While wi-fi versions would be nice they would have to look like a serial port surely, much like the XPORT modules I use in other products.
  • Cluso99Cluso99 Posts: 18,069
    edited 2012-05-03 02:33
    Nice find Peter :)
    Yes, would like the wifi to be serial too.
  • RaymanRayman Posts: 14,651
    edited 2012-05-03 03:15
    phishguy, just so you know, there are a ton of lower priced modules that don't have the through-hole pin connector like the one OBC has...
    The ones with the connector are like the one you found, but soldered onto a slightly larger motherboard...
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2012-05-30 00:07
    I've been playing with these modules and have found them very easy to work with. The really cheap ones out there charge extra for postage which brings them back into line with the 4-pin mounted ones I get for less than $8. BTW, the 4-pin versions have an on-board regulator so you can power them straight from +5V. The default baud rate is 9600 if you don't want to fiddle with anything.

    I reconfigured PropForth to output 9600 baud serial onto different I/O on a separate header I have on one of my pcbs which is basically 2 Prop I/Os and +5V and ground. So I plugged the BT module in and went back to Windows and paired via a COM port then I just use TeraTerm to communicate. Having Forth preloaded onto the Prop means that you only need this BT link to download new code etc. I can issue commands for my systems directly to the Forth console which makes it a very easy platform to develop on, and now, no wires!

    BTW, BlueTerm from an Android tablet works beautifully too!
  • prof_brainoprof_braino Posts: 4,313
    edited 2012-05-30 05:33
    Sal is using the $6.44 modules for MCS/Go channels. He's got them at the standard (for MCS) 230400 baud and running 16 or 32 channels over each bluetooth connection. He didn't collect throughput data yet, but it looks like its slightly slower than wired, but still useable. When 5.3 is getting ready for release, we'll want to compare notes with you, as this bluetooth + MCS is looking like a new addition to the automated testing support.

    I didn't order any yet, but these are looking really cool.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2012-05-30 21:35
    Sal is using the $6.44 modules for MCS/Go channels. He's got them at the standard (for MCS) 230400 baud and running 16 or 32 channels over each bluetooth connection. He didn't collect throughput data yet, but it looks like its slightly slower than wired, but still useable. When 5.3 is getting ready for release, we'll want to compare notes with you, as this bluetooth + MCS is looking like a new addition to the automated testing support.

    I didn't order any yet, but these are looking really cool.

    Are these the same modules that I am using? Do you have a link for the ones that Sal is using?
    The best price I can get for the 4-pin version is $6.80 in 50 off but I may end up using the SMD version on my own adaptor to suit my standard 8-pin PropPlug/Expansion header.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2012-05-31 02:13
    Hi Prof, no need to worry about a reply, I found your link in the other thread so they are the same modules excepting of course the cheaper one is just the SMD module vs the ready to go 4-pin module. I decided to hook it up to the PC and check it's command codes and was able to set it to 230400 baud as well as change the device name. The unit holds the last setting which is what I want for a transparent connection. Using the latest FastSerial PropForth beta I set it up to 230400 baud and pasted a fair bit of code into it over bluetooth without mercy...... and it took it !!! Way to go, I will have to play some more :)
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2012-06-04 16:28
    I have tried out these 4-pin Bluetooth modules on the Prop and especially with PropForth as the OTA diagnostics, command handler, and software development environment :smile: (non-Forthers are missing out big time). However I would like a module that would plug straight in to my Prop boards. These use an 4x2 header that's compatible with the Prop Plug as well. So I've ordered about 50 of the SMD Bluetooth modules which I will mount on my own backplane along with a few extra components. Before I go and get these backplane pcbs made maybe I can add a few enhancements, perhaps even a cheap (39 cents) MSP430 to monitor the serial and allow for OTA Prop bootloader programming.

    Here's a screenshot of the pcb artwork with the brown patch on the right side reserved for the BT's PCB antenna. The 5-pin connector on the left side is for SPI programming of the BT module via CSR's SDK while the 4x2 connector is what I want. The left hand side of this connector is PropPlug compatible if you flip the module upside down in which case I might allow for an extra LED to be mounted on the same side as the BT module to indicate state. The other 4 pins are usually I2C and VCC and a spare although in this version I have allowed for RTS/CTS if required, and if not then I don't loaded the resnet next to it.

    It's a pity that Parallax standardized on a 4-pin programming connector but never allowed for power with a 5th pin. On some boards I just add an extra power pin in series with the four however this pin is usually 5V so I always have a good LDO regulator so that I can operate from 5 or 3.3V as in the case of this adapter.

    BTSER.jpg


    So what do you think? Is there something I can add to this to help make it a bit more universal that more people can use?
    1024 x 430 - 74K
  • Cluso99Cluso99 Posts: 18,069
    edited 2012-06-04 19:20
    Nice work Peter.

    If possible, I use 5V,GND,/RTS,SI,SO,OUT as a 1x6pin header where the middle 4 are propplug. You don't have room for the OUT pin, but if possible I would like the 5V to be added above the gnd piin on your 2x4 header. My propplug equiv has this 6pin header (its on tubulars smorgasboard) which can provide 5v from the USB. This would make your board compatible to this propplug connection. IIRC Bill uses 3v3 and gnd the I/Os as a standard also. Just need provision for a link to bypass the onboard regulator.

    Which 3v3 regulator are you using. I use the MCP1700T-3V3 and use large pads to give a bit of heatsinking. The other day I found Element14 (local) have a sot23 regulator that will take up to ~15V input and 800mA and about the same price. I need to check its full specs but think this may be better than we are both using. I'll let you know offline.

    Do you have soace perhaps for an ATTiny 44/84 SOIC16 on the underside? If so, it can be programmed by the prop (I have posted code).
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2012-06-04 20:12
    No problem to put an extra pad in-line next to the ground of the PropPlug section, it just fits in. I could put another pin on the other side of the board next to RXD if that helps too. I'm using a variety of 3.3V regs as there are so many to choose from and it is possible to use a good LDO that only drops less than 50mV so it doesn't matter if you run 3.3V straight into it. Even the cheap TC1185 (SOT-23) is close to this. BTW, what's the use of 15V input and 800ma anyway, the regulator's power handling is limited by the package, so it's going to be something like 15V input at 20ma or 3.6V input at 800ma (slightly exaggerated).

    If I use an ATTiny I would go for the QFN pack due to it's compactness. There doesn't seem to be any TSSOP packs readily available. My favorite is to use the Silabs chips even though they cost a little more, they are easy to ICP etc.
  • Cluso99Cluso99 Posts: 18,069
    edited 2012-06-04 20:26
    Just the single 5V pad would be great. The other is not used here anyway. You have the MISO,MOSI & CLK which is reqd to program ATTiny's plus reset.

    Yes, its a pity there is not TSSOP for the ATTiny's. The SOIC16 (ATtiny24/44/84) takes the same space as the SOIC8 (ATtiny25/45/85) and they are almost the same price, so pointless using them. I am still not into QFN packages yet.

    OT I have a small pcb with QFNs for gyro, accelerometer, compass and pressure/temp. Could you do me a favour and reflow one for me???
  • RS_JimRS_Jim Posts: 1,765
    edited 2012-06-05 05:38
    Peter,
    Are you going to make these boards available assembled? If so, how much & how soon?
    Jim
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2012-06-05 23:17
    After much deliberation I made what I think are my final design decisions and changes. I have considered quite a few different micros but added a cheap MSP430G2001 micro to the board so that it can permit OTA Prop firmware updates directly to the EEPROM (if you use the extended 4x2 pins) using a special command sequence and standard HEX files. It should be possible to also program the Prop via it's bootloader. The on-board micro also handles the firmware programming of the Bluetooth's Flash so I was able to get rid of a connector but this requires different firmware loaded into the MSP430 if this is ever necessary.

    The Prop uses the center outside 4 pins when this module is flipped over otherwise the connector suits my 4x2 and 5x1 PropPlug pin-outs. So there is a VCC connection on either side of the 4-pinProp Plug to suit other formats such as Cluso's. The other two extra pins are for programming the on-board micro.

    BTSER+BSL.jpg

    BTSER - Bluetooth Prop backplane module
    Overall length including BT antenna is 1.3" x 0.56"

    And yes, I will make these available soon as an assembled item, I just need to get some pcbs back and test them out. Should be good. Price is going to be a little bit more than what you would pay for the 4-pin ebay version but I will keep it cheaper than the PropPlug.
    1024 x 442 - 94K
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2012-06-06 21:19
    Here's an update on the pcb I did for these BT modules so that they can plug directly into a PropPlug plus allow OTA firmware updating (but not through the Spin tool). The PCB manufacturer quotes me 13 cents a piece for these boards so that even after I order 240 of them the shipping cost is still greater which is still far less than the tooling costs. In the end the pcbs end up costing 86 cents each in quantities of 240. I read and identified with the "Perils of pedward" about his PropKey and getting these manufactured in small quantities, it's something I go through all the time.
  • RS_JimRS_Jim Posts: 1,765
    edited 2012-06-07 06:14
    Here's an update on the pcb I did for these BT modules so that they can plug directly into a PropPlug plus allow OTA firmware updating (but not through the Spin tool). The PCB manufacturer quotes me 13 cents a piece for these boards so that even after I order 240 of them the shipping cost is still greater which is still far less than the tooling costs. In the end the pcbs end up costing 86 cents each in quantities of 240. I read and identified with the "Perils of pedward" about his PropKey and getting these manufactured in small quantities, it's something I go through all the time.
    Ready to buy 2 when you're ready to sell!
    Jim
  • rwgast_logicdesignrwgast_logicdesign Posts: 1,464
    edited 2012-06-08 08:01
    well im not sure if gcc can compile to a hex yet which sucks for me :/.

    but you could make a file with a compiler and then send it directly to your prop? ill have to look at what the compilers that run on an android can do in terms of this.

    just to clarify im not a fourh hater! i acually am building a calculator for programmers/hardware guys and i want to add bt com and sd. the reasoning is to make it fully wirelessly programmable with the intergrated 4th engine.

    the problem at hand though is mostly abobout using a standard wirless protocol to program the prop with its native programming protocol. this makes programming with a phone a snap.

    like i said above i belive the ebay chips have spi and rts which could be used as reset. then all the tools are in order to do bt programming from a phone. im willing to mail my bt key to someone to compare with an ebay key if they can find the rts pin on the ebay. this would entail running bt software on any platform that uses rts. monitoring the csr16 wave forms/logic/bus data. then running the same code on the ebay csr17 and trying to find matching wave forms. im sure there are other ways but thats my solution. i just dont have the tools or the know how to connect to the spots where i burned off the pads. im also not sure how to get my key doing spp when pluged into a pc
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2012-06-17 21:57
    Well I finally got got a whole stack of Bluetooth modules and the new backpack pcbs. I've just finished putting one together and soon I have to write some code for the bootloader micro so that it can receive hex files and load them directly into the Prop. Next stage is loading the Prop via it's bootloader. However for a lot of my projects this doesn't matter as I use PropForth and load in new source code files which are compiled by the Prop. The hex file format will be good when I want to load up a completely blank Prop or downloading a binary compiled from Spin/C/Basic etc.

    Here is a shot I took of it next to a footprint compatible PropPlug (my version). There's also a shot of it in place of the PropPlug inside of one of my DIN raill mount products so that this product can be accessed via a laptop or smartphone/tablet while it is in operation.
    BTSER+USB-m.jpg
    CE1200_BTSER-m.jpg


    So the BTSER module looks like a PropPlug if you just use the 4 pins in the center on the edge.
    Once I sort out the bootloader I will put these up for sale.
    1024 x 1127 - 264K
    1023 x 973 - 218K
  • Cluso99Cluso99 Posts: 18,069
    edited 2012-06-17 22:05
    Nice job Peter!
    Is that an aluminium extrusion? What material do you use or endplates?
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2012-06-17 23:56
    Cluso99 wrote: »
    Nice job Peter!
    Is that an aluminium extrusion? What material do you use or endplates?
    I was scratching my head trying to figure out what you meant but maybe you were looking at the DIN rail case I use which is a fairly standard Phoenix case. The bottom of it is where the LEDs protrude and the COMBICON connector goes in like this...
    case-m.jpg
    1023 x 1185 - 156K
  • Cluso99Cluso99 Posts: 18,069
    edited 2012-06-18 00:48
    Yes, I thought it was an extrusion but I see now. I will have to look it up.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2012-06-18 20:46
    Woohoo, my Puppies now have pals in the form of Bluetooth modules that connect to the extra programming pins on the edge of the module. So even if the motherboard doesn't have a PropPlug or similar connector I can still hook-up directly to the Prop module. The Bluetooth module allows for up to 8 extra pins on top of the central PropPlug style pins so I decided to use a 2x6 way low profile socket instead of my more usual 2x4 which means it connects up to the Puppy's extra VCC pin for power but still leaves it compatible with the other headers.
    Puppy Pals.jpg

    When I get all these modules and a website organized I will offer the PuppySolo and the PuppyProp preloaded with PropForth and a Bluetooth "puppyback" module, that way you just plug it in or connect power and start programming it, even with your smartphone.
    1024 x 283 - 106K
  • Dr_AculaDr_Acula Posts: 5,484
    edited 2012-06-18 21:20
    I'm following this thread with great interest. I've got this idea - take a touchscreen board that uses switch mode supplies and run it of 6 to 8 AA rechargeables and combine it with your bluetooth programming and there could be no wires at all. Keep up the good work!
  • Heater.Heater. Posts: 21,230
    edited 2012-06-18 21:37
    rwgast_logicdesign,
    Yes of course you can get hex files out of GCC.
    GCC compiles source files to binary object modules, these are then linked to a binary program in ELF format.
    There is a program supplied with GCC, objcopy, that can be used to extract the executable codes from an ELF file and write them out in hex.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2012-06-19 08:25
    Just a little update on the BTSER modules, I've found that I can set the baud rate up to 921600 and I believe they should be able to go up to 1382400 as well but I have to check this with another setup otherwise I won't be able to set it back :)
    The throughput looks really high but I should know a bit more once I test this in a controlled setup. I want to be able to initiate a connection from a module to another module but the firmware on these does not allow this as it is setup to work transparently, which is also a good thing. However I happened to have gotten hold of the SDK for the Bluetooth chip and I have the module's SPI programming pins connected to my bootloader micro so I should eventually be able to load in different firmware such as the HC05 instead of HC06 version. This means the module can work as a master.
    I have also successfully set this parameter and the module name and pin straight from the Prop assuming the Bluetooth link is not active at the time.
  • RS_JimRS_Jim Posts: 1,765
    edited 2012-07-01 07:30
    Just a little update on the BTSER modules, I've found that I can set the baud rate up to 921600 and I believe they should be able to go up to 1382400 as well but I have to check this with another setup otherwise I won't be able to set it back :)
    The throughput looks really high but I should know a bit more once I test this in a controlled setup. I want to be able to initiate a connection from a module to another module but the firmware on these does not allow this as it is setup to work transparently, which is also a good thing. However I happened to have gotten hold of the SDK for the Bluetooth chip and I have the module's SPI programming pins connected to my bootloader micro so I should eventually be able to load in different firmware such as the HC05 instead of HC06 version. This means the module can work as a master.
    I have also successfully set this parameter and the module name and pin straight from the Prop assuming the Bluetooth link is not active at the time.
    Peter,
    What is the latest ?
    Jim
Sign In or Register to comment.