Interfacing with Bluetooth JY-MCU

= Description =

The small size Bluetooth TTL transceiver module is designed for serial communication (SPP - serial port profile). It allows your target device to both send or receive TTL data via Bluetooth technology without connecting a serial cable to your computer.

With this simple example, you will be able to control your Pinguino through Bluetooth.

It will switch the built-in led on if 'h' is received, off if not.

= Material =


 * Pinguino
 * Bluetooth module: JY-MCU BT_BOARD (or any other Bluetooth module)



For a summary of the different serial port profile Bluetooth modules, firmware, pin outs and AT command sets, see SPP Bluetooth Modules.

= Wiring the module with Pinguino =


 * JY-MCU Board/Bluetooth module RX to Pinguino TX
 * JY-MCU Board/Bluetooth module TX to Pinguino RX
 * JY-MCU Board/Bluetooth module GND to Pinguino GND
 * JY-MCU Board/Bluetooth module VCC to Pinguino 3.3V (or 5V - but first see the warning below)

Warning: the Bluetooth chip is rated for 3.1V to 4.2V - connecting VCC to 5V is only ok if you are using a bluetooth module on a board like the JY-MCU Board which includes a voltage regulation circuit to limit the voltage, otherwise you will fry the Bluetooth chip on your module and be very sad.

= Host side (PC/GNU Linux) =
 * Switch on the Pinguino (BT led should blink)
 * Start your favorite Bluetooth Manager (e.g. Blueman on Linux)
 * Search (should find "linvor" module)
 * Pair (pin code 1234)
 * Set as trust device
 * Connect (BT led stay on)
 * Start your favorite Serial Terminal (e.g. GTKTerm)
 * Configure /dev/rfcomm0 to 9600, N, 8, 1
 * Press 'h', Pinguino's led should switch on
 * Press anything else, Pinguino's led should switch off

= Host side (PC/Windows) =
 * TODO

= Host side (PC/Mac) =

As the Mac Mini has a Bluetooth adapter already built-in, there is no need to add a USB Bluetooth adapter, though you should check to see that Bluetooth is enabled (System Preferences -> Bluetooth).

To connect wirelessly:


 * Power up the Pinguino and BT module
 * Choose Bluetooth from the OS X menu bar
 * Choose Bluetooth Setup Assistant
 * Bluetooth device shows up as "linvor" - select continue
 * Pairing will fail, so select Passcode Options
 * Select Use a specific passcode
 * Enter passcode 1234, press OK ... should pair successfully, so Quit
 * The connection LED on the BT module should still be flashing
 * Open a terminal window and list the /dev directory (ie type )
 * You should see two new device entries similar to tty.linvor-DevB and cu.linvor-DevB
 * Use screen in a terminal window to connect to the BT module (ie type )
 * The connection LED should stop flashing and stay solidly lit indicating a valid connection
 * You can now send/receive data wirelessly via bluetooth (note: there will be no local echo).
 * Press 'h', Pinguino's led should switch on.
 * Press anything else, Pinguino's led should switch off.

To enter AT commands, you need to:


 * Connect the BT modules four external pins (+3V3, GND, RX, TX) to a TTL UART<->USB converter (note: voltages are TTL not RS232)
 * Open a terminal window and list the /dev directory (ie type )
 * You should see two new devices similar to tty.SLAB_USBtoUART and cu.SLAB_USBtoUART
 * Use screen in a terminal window to connect to the BT module's external TTL UART (ie type )
 * You can now send AT commands to the BT module provided you are not connected to the device wirelessly - that is, the connection LED must be flashing (note: there will be no local echo).

= Host side (Androïd Smartphone) =
 * Switch on the Pinguino (BT led should blink)
 * Start your favorite Bluetooth Manager (e.g. BlueTerm available on Google Play Store)
 * Connect Device (should find "linvor" module)
 * Pair (pin code 1234)
 * Press 'h', Pinguino's led should switch on
 * Press anything else, Pinguino's led should switch off

= Code Source =