PIC + Bluetooth + PC and schematics!!!

Discussion in 'Embedded Systems and Microcontrollers' started by Eric007, Aug 28, 2012.

  1. Eric007

    Thread Starter Senior Member

    Aug 5, 2011
    1,044
    33
    Hi All!

    I am trying to come up with an hardware interface that would enable PIC mcu to communicate with PC via bluetooth!

    I have done some readings and have a general idea of how it works but would need serious help from you guyz!

    Unfortunately I am not able to provide a schematics for checking my circuit as I am reading a small tutorial (will actually start right after this post) on how to draw schematics with 'Eagle 6.20'.

    * I would like to design my circuit in such a way that it can accept both 'serial cable' or ' RS232 bluetooth module' ! The reason being is in case I have a problem with my bluetooth communication, I would have my 'serial cable' as backup!

    * One thing I know is that the chosen PIC mcu must have 'USART' capability and I have PIC18F26K20 (PDIP package type) at hand that I am planning on using for this purpose!

    * I would need a 'MAX232' chip to convert between 5V and +- 12V RS232 and RS232 DB9 female I guess!

    My concern is the choice of the RS232 module!
    On mcu side I need a low cost cheap bluetooth that would do the work and I think should have the following characteristics:
    - hardware interface through UART
    - i dont need long range so 5-20 meter would be ok
    - ...

    and on the PC side I would need a USB Bluetooth dongle!

    Any suggestion on the above two bluetooth modules would be greatly appreciated!

    I need to know the exact components so I can already ORDER while designing the shematics!

    I'll try my best to post a schematics as soon as i can! Once schematics is OK it will be converted to PCB!

    Thanks in advance!
     
    Last edited: Aug 28, 2012
  2. maxpower097

    Well-Known Member

    Feb 20, 2009
    795
    388
    Eric007 likes this.
  3. Eric007

    Thread Starter Senior Member

    Aug 5, 2011
    1,044
    33
    Thanks maxpower097! I will have a look at it!
     
  4. Eric007

    Thread Starter Senior Member

    Aug 5, 2011
    1,044
    33
  5. Eric007

    Thread Starter Senior Member

    Aug 5, 2011
    1,044
    33
    I think the attached document is the solution for me!

    I am readding on it!

    with this I think on the microcontroller side I would have an hardware interface circuit similar to the one attached and that circuit will be the same for 'serial cable' or 'the RS232 bluetooth module' am I correct?

    Now I think I have to read on AT command and UART, correct?
     
  6. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    In the simplest form. You do not need the handshake signals. Just the RX and TX signals plus ground. It would a good idea to start with a simple cable connection. Start with very basic coding. and some terminal program on the PC. First write some code that send some constant letter(s) from the PIC to the PC in an endless loop. Then this is working. Try to make a program on the PIC. That echo all letters sent from the PC terminal program. Most bluetooth modules use 3.3 volt as supply voltage. Perhaps you should already at this point design your system. Using this supply voltage. However using this supply voltage. You can not use the standard max232 chip. But try the MAX3232. Note these chips are most often sold in SMD type package. If this is a problem. Be sure you order a PDIP variant. I think Digi-key have it in PDIP package
     
    Eric007 likes this.
  7. BMorse

    Senior Member

    Sep 26, 2009
    2,675
    234

    AT Commands?? Are you planning on using a modem?? Last I knew, you didnt need AT commands to use a bluetooth module, all those are are pretty much a wireless serial port.....

    I am not sure, but I think you are trying to put the "horse before the carriage" so to speak. I would keep it as simple as possible to start, use a wired method of connecting to the PC, once you have everything working, then add some wireless connectivity between the 2. Trying to debug all of this together will be very overwhelming at your skill level, and you will not have this done any time soon.... Start with a microcontroller project to communicate to the PC via UART, you can use an FTDI IC to connect from TTL (Microcontroller) to USB (PC), this will simplify your connection, then later on when you decide to use a bluetooth module or other wireless device, they can just connect right to the FTDI IC to interface to the PC.


    Currently I am working on a project that sends data between 2 modules and a PC using Lynx technologies' TRM-433-LT transceiver IC's..... these have a range of up to 3000', and I can honestly say that even with my skill level, I still ran into a few issues utilizing the wireless connectivity between modules since the 433MHZ band is susceptible to a lot of "noise"... so I would start at the simplest form of communication, wired, you will only need 3 lines to connect to the PC TX, RX, and Ground.
     
    Last edited: Aug 29, 2012
    maxpower097 and Eric007 like this.
  8. Eric007

    Thread Starter Senior Member

    Aug 5, 2011
    1,044
    33
    Thanks so much t06afre and BMorse!!!

    I will reply in a few minutes...
     
  9. Eric007

    Thread Starter Senior Member

    Aug 5, 2011
    1,044
    33

    I agree with you 100% on you comment. I think I should not waste my time with 'bluetooth' for now. I will simply use serial cable to communicate between mcu and PC as suggested and when everything works then I can try to integrate the wireless comms!

    I will test communication on breadboard BUT final implementation MUST be on PCB! I will write simple program as suggested and as we all know hardware comes first!

    And my concern is to have/design a *single* circuit that would work with both *serial cable* and *bluetooth (3.3V)* even if I don't add the bluetooth later on...

    Also are you suggesting 'MAX3232' to handle both *cable* and *bluetooth* or what?

    And I need to know *all the components* I would need for THIS circuit to order all at once from 'digi key' it takes me *one week* to get packages from digikey!

    Thanks again
     
    maxpower097 likes this.
  10. Eric007

    Thread Starter Senior Member

    Aug 5, 2011
    1,044
    33
    Ok! but I never used *bluetooth* before...I was kinda lost before you guyz started posting and now you are putting me into the right direction!

    I got it now! Only RX, Tx and GND are needed in both cases (cable and bluetooth).

    And beleive me I am tryimg to keep it simple as my signature say *the best solution is the simplest one* but as I said was a bit lost!

    Also note that I will use this for my *chess project*

    Thanks again
     
  11. Eric007

    Thread Starter Senior Member

    Aug 5, 2011
    1,044
    33
    I am reading on MAX3232...datasheet
     
  12. Eric007

    Thread Starter Senior Member

    Aug 5, 2011
    1,044
    33
    MAX3232, best pet, from 3.0V to 5.5V <-> RS232 ...
    MAX232: 5.0V <-> RS232 ...

    datasheet explains everything + connection! this is good!
     
  13. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    You do not need a MAX232 type chip between the PIC and the Bluetooth unit. Just run them at the same supply voltage. Most probably 3.3 volt.
    RS232 use different logical voltage levels than your PIC and BT device. A MAX232 type chip is level converter chip. I think it would be an good idea to order a MAX3232 type chip. As it will be useable in 3.3 volt type application.
     
  14. Eric007

    Thread Starter Senior Member

    Aug 5, 2011
    1,044
    33
    I understood you perfectly Sir!

    That's why I said MAX3232 is the best pet as it works from 3.0V and most BT device need 3.3V for their operation!

    I will order and use MAX3232!! And I understand the role of RS232 as well (it used to convert between voltages level as I mentioned in my OP)

    correct?
     
  15. BMorse

    Senior Member

    Sep 26, 2009
    2,675
    234
    That is why I suggested the FTDI IC, (Pre made modules can be bought at Sparkfun), these have built in 3.3 V output to drive such items that require 3.3volts(Bluetooth module, etc).... plus using a MAX3232 or MAX232CPE will still require the PC to have a serial port, which most new ones do not have any, so you will have to use USB to RS232 converter also in between the uC/MAX3232 and PC, the FTDI serial to USB IC's takes care of all these issues you can run into....

    and you use these IC's just like you are using the MAX3232, all connections still only require 3 lines to the UC...
     
    Last edited: Aug 29, 2012
    maxpower097 likes this.
  16. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    So far your design approach looks good. But the idea from BMOrse is not bad. It will be less part assemble and hence that can go wrong. I would suppose these two parts will be able to do the job
    https://www.sparkfun.com/products/9873
    https://www.sparkfun.com/products/9717
    However if you use item 09717 to power a 3.3 volt BT device. You must use a 3.3 volt low dropout regulator
     
    Eric007 likes this.
  17. Eric007

    Thread Starter Senior Member

    Aug 5, 2011
    1,044
    33
    I think I will order both and have two different circuits! it always good to have an alternative!


    So in case one gives me trouble I would have the other option and will also give me the opportunity to learn both ways!


    @ Bmorse: what are the major components for the communication between *PIC* and *PC*? a part from FTDI serial to USB IC!


    Thanks!
     
  18. Eric007

    Thread Starter Senior Member

    Aug 5, 2011
    1,044
    33
    Thanks SO much guyz ...

    I am going out of town now and wont be able to view your posts and come back tomorrow and finish up with this

    Thanks a millions! really appreciate the help and guidance!

    BTW, 09717 looks better...will ask more about this tomorrow!
     
  19. BMorse

    Senior Member

    Sep 26, 2009
    2,675
    234
    3 wires...... TX, RX, and a Ground wire, (which go right into the FTDI TTL I/O) and a USB cable (goes from FTDI module USB connector to PC USB).

    If you get the cable assembly from above post (although, I would recomend the first module, since it provides the necessary 3.3 volts, with the cable you will still need a separate power source to provide 3.3 volts.), then that is all you will need, (Besides some pin headers on your uC circuit to plug the cable header into)...
     
    Last edited: Aug 29, 2012
    maxpower097 likes this.
  20. BMorse

    Senior Member

    Sep 26, 2009
    2,675
    234
    for now the connection should be straight forward like this:
    this is what you should concentrate on right now to get accomplished, once you are done, everything else will be a piece of cake (hopefully, all depends on your programming skills...;))
    uC to USB1.jpg

    Then once you have everything working the way you want, then you can add the bluetooth modules like this:

    uC to BT to USB1.jpg
     
Loading...