Menu

RF Wireless with Great Cow Basic and INHAOS LC-2000PA RF Modules

2016-06-23
2016-07-01
  • William Roth

    William Roth - 2016-06-23

    Wireless RF applications can be a challenge, especially when using "dumb" ASK RF modules with limited range and limited communication speed. (2400 baud/ 100 feet). RF comms with these modules typically require the user/programmer to provide code for sending a preamble, a syncword, and for packet handling.

    Alternatively, "smart" RF modules do most of the heaving lifting, alowing the application to focus on other things. This means less MPU load, a much more reliable RF link, and faster RF comms. The RF modules used here are INHAOS LC-2000PA modules. These operate at 2.4GHz and have an integrated 32-bit ARM processor doing the RF chores.

    This series of posts will show how to integrate these relatively inexpensive and intelligent RF modules with a PIC microcontroller and Great Cow Basic.

    This project is for intermediate to advanced users, however a beginner can successfully replicate this project if instructions are closely followed.

    When completed you will have:

    1) A robust "Point to Point" comm link from A PC to a PIC.
    2) Serial data rate selectable from 2400 to 115200 baud.
    3) Autobaud detection. (Slave follows Master)
    4) The capability of wireless remote programming of the PIC microcontroller
    5) RF range of 200 - 300 meters depending upon location/terrain.

    What you will need:

    1) The latest version of Great Cow Basic
    2) A Master/Slave Pair of INHAOS LC-2000PA RF Modules
    3) A CP2102 USB/TTL Adapter that brings out either DTR or RTS

    4) A PIC18F14K22 Microcontroller - Can be substituted - Ask First!
    5) A Pickit2 or Pickit3 Programmer (For loading bootloader)
    6) TinyMultiBootloader+ (I can provide Hex file(s) if needed)
    7) A breadboard and associated accessories
    8) Soldering Station /Iron / Solder, flux, etc

    A complete BOM will be provided in the next post.

    More to come ......

     

    Last edit: William Roth 2016-06-23
  • William Roth

    William Roth - 2016-06-29

    Attached is a schematic showing how to connect the LC2000 Slave to a PIC Microcontroller
    Follow this precicsely as all components are there for a reason.

    LC-2000 RF modules have 1.27mm pin spacing and cannot be plugged directly into a bread board, so flying leads were soldered onto the LC2000 Slave to allow for breadboarding the prototype.

     

    Last edit: William Roth 2016-06-29
  • William Roth

    William Roth - 2016-06-29

    For the PC side of the comm link all you need is an LC-2000PA Master and a USB/TTL Adapter that brings out DTR or RTS. RTS or DTR will be used later when implementing wireless RF programming of the PIC chip.

    I highy recommend that you order 2 of the LC-2000 Connect Boards as these eliminate the need for soldering flying leads onto the Master RF module and make programming the LC2000 modules easy.

    These connect boards include a nice USB/TTL adapter with cable and also include an AMS117 3.3V regulator rated at 1 amp. A bargain for < $5.00 each.

    So, for the PC/Master side:

    Simply plug the LC-2000PA Master into the connect board, then plug the supplied USB/TTL cable adapter into the connect board and plug it into a USB Port.

    If not already installed, you will need to install the SiLabs CP2102 VCP drivers onto your PC.

     

    Last edit: William Roth 2016-06-29
  • William Roth

    William Roth - 2016-06-29

    **Configuring The LC-2000 Master.

    The only thing that really needs to be configured is the "P2P Baud Rate" of the Master This is the baud rate of the serial connection between the Master LC2000 and the PC. This has nothing
    to do with the RF data rate.

    ** It is not necessary to configure the Slave Baud Rate as it automatically follows the master using autobaud detection.

    **With Tool:

    1) Download and install the "LC-3000 Debug Tool" from INHAOS.
    2) Open the tool and open the Com Port for the CP2102 adapter.
    3) On the right side pane of the tool find Set P2P Baud Rate
    4) In the scroll box select 19200
    5) While pressing down the Config button on the connect board click Set P2P baud Rate.

    The Module will send back "=910:" which can be seen in main window

    **To verify:

    2) 1) While hold down the config button click "Get P2P baud Rate"
    The Module will send back "=810:019200"

    **With Terminal Application:

    Alternatively the Master can be configured with a Terminal Application.

    Open the Terminal for the CP2102 ComPort. The baud rate does not really matter since the LC2000 uses auto baud detection. But for now use 9600.

    While holding down the config button send the following from the Terminal
    =910:19200

     

    Last edit: William Roth 2016-06-30
  • William Roth

    William Roth - 2016-06-29

    Paring the Master & Slave.

    "Pairing" configures the two modules so that they can communicate with each other.

    1) Press and hold the Config/pair button on the master until the "busy" LED begins flashing
    2) Press and hold the tiny Pair button on the SLAVE until the busy LED on the MASTER stops flashing.

    Modules only need to paired ONCE. Once paired, they will automotically find each other when both are powered up.

    NOTE: If you change the Address of a module, pairing will be lost and the Modules will need to be paired again.

    When the busy "Green LED" on an LC-2000 module is off it is paired with another module. If the LED is ON then the module is not Paired.

    "Paired State" is constantly monitored by the LC2000 Firmware. If one module loses power the Pair/Busy LED on the other module will turn ON.

     
  • William Roth

    William Roth - 2016-06-30

    Once the a Master & Slave are paired the communications link can easily be tested. Simply press the DTR button on the Master connect board and the DTR LED on the Slave will activate. Lag time is only about 5 ms from the time DTR is pressed on the master, until DTR is active on the slave.

    The DTR pin on the Master LC-2000 is always an input, while the DTR pin on the Slave LC-2000 is always an output. It is this DTR feature that will allow wireless programming of the PIC attached to the Slave LC-2000 when the PIC has a bootloader installed. More on Wireless Prgramming later.

     

    Last edit: William Roth 2016-06-30
  • William Roth

    William Roth - 2016-07-01

    Test Code

    The attached code is to demonstrate the serial link by controlling an LED remotely. You will need to add an LED to the previously posted schematic. I used PORTB.6 for the LED. Modify the code as necessary for your chip.

    To Test, program the PIC with this code. Then open a Terminal Application with the Com Port configured for the port that the MASTER LC-2000 Module is connected to. Baud rate should be 19200.

    There are only 2 valid commands that the Slave will accept. All other commands/data will be ignored.

    1) LED_ON
    2) LED_OFF

    Type LED_ON in the "send" buffer ( No added CR or LF ! ) Then send
    The LED should energize.

    Then type LED_OFF ... Then send ...
    The LED should turn off.

     

    Last edit: William Roth 2016-07-01
  • William Roth

    William Roth - 2016-07-01

    Wireless Programming

    With a Master/Slave Pair of LC-2000 RF Modules, wireless programming of a PIC can be performed at a range up to 300 meters (LOS) under ideal conditions. Realistically, expect between 100 to 200 meters. I am sucessfully prgramming the PIC16F1829 all the way across the house and through several walls without errors.

    Wireless Programming requires that the PIC Microcontroller be programmed with a bootloader. A bootloader is a small program that allows the microcontroller to be programmed via a serial interface. This implementation uses TinyMultibootloder+. This is a free open source bootloader.

    Here are the steps required for wireless programming.

    1) Download the bootloader hex file to the PIC. (Requires a programmer)
    2) Connect the LC-2000 Slave to the PIC per the schematic
    3) Connect the LC-2000 Master to a PC using the "Connect Board"
    4) Configure the LC-2000 Master P2P baud rate to match the bootloader baud rate.
    5) Modify the GCB "FlashPic.bat" file to use TinyMultiBootloader+
    6) Configure TinyMultiBootloader+ to use DTR instead of RTS

    Details to Follow

     

    Last edit: William Roth 2016-07-01

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.