Shop OBEX P1 Docs P2 Docs Learn Events
The Propeller And IC RN42-I/RM... Will This Work? — Parallax Forums

The Propeller And IC RN42-I/RM... Will This Work?

idbruceidbruce Posts: 6,197
edited 2020-08-28 15:23 in Propeller 1
Hello Everyone

I want to be able to communicate with the Propeller through Bluetooth using the RN42-I/RM, but I am looking for minimal circuitry. I believe this should work with direct connections to (2) Propeller IO pins, with perhaps some resistors inline, but I could be wrong :)

Did I mention that I am not an electronics genius? :)

Pin #4 (GPIO7) sets the baud rate to 9600.

As asked in the title, will this work as shown? The datasheet is attached below.

RN42.png

Comments

  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2020-09-06 00:40
    I just checked the price for these RN42 modules, yikes! When ESP32 modules from Mouser/Digikey are under $4, a BT only module seems very expensive. However it looks like according to fig1-1 in the datasheet that you only need rx/tx and that's fine but make sure you allow for some bulk decoupling right next to the supply in case your regulator is far away (as in inches). Sometimes it doesn't hurt to give RF modules their own regulator if it is easy enough. The ds shows a TC1185 but there is nothing special about that and there are plenty available in small packages. But I am just saying that in general and the RN42 only draws 50ma max.

    You are forcing GPIO4 high for 9600 baud but why such a slow baud rate when the default is 115200? However, there is no problem allowing for a resistor there since you can then decide to place it or not.

    Allow for those LEDs as they may be useful when you are testing the prototype. If you allow for components you don't have to load them in production but you can load them during prototyping.

    If your pcb will allow for it I would place the SPI header as per the example application circuit which btw is a terrible example. I wish sometimes they would show examples that are at both extremes, so a minimal use case. I notice too that although the module has USB capabilities, that they use an FT232R for serial!!! :):(

    So go ahead with the minimum but make sure the smd pads extend out enough, maybe more than they recommend since this makes it easier for you to access with the soldering iron. I probably would only solder up those pads you are using and maybe a couple of others, just enough to secure it to the pcb, but not too many so that you can't remove it. At least for the prototype.

    Yes, it will work!

    P.S. If you terminate every connection to a small through-hole pad where you have room, then you can use this for testing or mods. Check what I did in the P2PAL for the ESP32 module.
  • Peter

    Thank you very much for taking the time to answer my question :) I do sincerely appreciate it.
    You are forcing GPIO4 high for 9600 baud but why such a slow baud rate when the default is 115200? However, there is no problem allowing for a resistor there since you can then decide to place it or not.

    I went that route, because the Parallax module has that set as the default baud rate and it worked perfectly for my application, but as you say, I can leave it out. I will probably test without the resistor and see how well it works for my application.
    Allow for those LEDs as they may be useful when you are testing the prototype. If you allow for components you don't have to load them in production but you can load them during prototyping.

    That is very good advice :) However it does take time to draw all the circuitry :) I had forgotten how tedious this stuff was :) I just discovered errors in my current layout from moving stuff back and forth :(

    I just sold some car parts :) I do believe it is time for a beer run :) Then I can make more mistakes :)

    THANK YOU PETER :)
  • If my wife tells me she is missing an ingredient for dinner, I say "no problem, we have wine". If I need to run a Windows app on Linux, I say "no problem, I have Wine". So no matter the problem, wine makes it better :)

    Here's one tiny little tip to designing pcbs: fix the positions of your connectors where they need to be and then place and orient parts so that it is almost lining up as much as possible, especially the critical routing. If necessary revisit any fixed positions and optimize. If your signals are having to via to other layers and back again too often then this is a sign that it could be optimized more.

    When everything is placed optimally then routing is a pleasure although the 90/10 rule still applies, that 90% of the work will take 10% of the time, and 10% of the work will take 90% of the time.

  • idbruceidbruce Posts: 6,197
    edited 2020-09-06 02:11
    If my wife tells me she is missing an ingredient for dinner, I say "no problem, we have wine". If I need to run a Windows app on Linux, I say "no problem, I have Wine". So no matter the problem, wine makes it better :)

    LOL.... So what you are telling me is that I should buy some wine instead of beer :wink: That is also probably very good advice :)
    When everything is placed optimally then routing is a pleasure although the 90/10 rule still applies, that 90% of the work will take 10% of the time, and 10% of the work will take 90% of the time.

    That holds true for most of the work that I get into, not just PCBs.
  • Beer for spicy foods I say, although my wife doesn't like the smell of beer on my breath :( but she has never complained about wine though :)

    That darned 90/10 rule rules. No way around it.
  • The thought of wine really sounded good and I had to ponder my choice for a moment or two, but I opted for the beer. :) With a beer in hand, and eleven more sitting in the fridge, I am ready to make a plethora of mistakes :) And who cares anyhow....? :) I can fix them all tomorrow :)

    I prefer white wine, but mostly a good Chardonay.
  • Mistakes? I'm on site (again) and I hit a snag so I'm doing what I do when possible and adjourn to the pub down the road. Already figured out the problem (I think) so it's time to go back.
    Only problem is that this place is really hopping....loud music, people dancing around and young women who insist on speaking to me...one more pint and I'm outta here...says he :lol:
  • Hi all - In case more input is still of any use, I've been using the RN42 with the Propeller for several years. The answer is yes, you can connect it directly to the Prop. I don't know enough to say that there aren't some subtle reasons why that's not a good idea, but I can say that we now have some boards working in the field (for which we used a direct connection) for just shy of 10 years. I'm replacing it now with something less expensive, but I started out with it because it comes on the little pluggable "paddle board", which decreased some risks in the early designs.

    you may want to consider connecting the reset lines and the status, in case you can't get what you need through the serial interface.

    my schematic reflects the XV version of the module, so the pinout is different.
    902 x 424 - 81K
  • To clarify my previous post: you'll see some 100ohm resistors in-line with some signals, but in other designs, we didn't use resistors. The 100ohm are there for a special use-case and aren't necessary.
  • chris_bfs wrote: »
    To clarify my previous post: you'll see some 100ohm resistors in-line with some signals, but in other designs, we didn't use resistors. The 100ohm are there for a special use-case and aren't necessary.

    All of the 100 ohms can be eliminated or just some?
  • Cluso99Cluso99 Posts: 18,066
    Bruce,
    Peter's advice is great. We chat regularly and he knows what he's talking about!

    Since the RN42 is operating at 3V3 there is no need for series resistors between the tx/rx and p32/31 on the prop.
    Put a 1-10uF ceramic bulk capacitor and a 100nF (0.1uF) ceramic bypass capacitor as close to the power and ground pins of the RN45 chip. Use MLCC X7R or X5R ceramic capacitors, not Z5U or Yxx! The voltage needs to be at least 6V but at these capacitances 16V or more are readily available.
  • @Cluso99
    Peter's advice is great. We chat regularly and he knows what he's talking about!

    I trust his input and I trust yours as well :)
    Put a 1-10uF ceramic bulk capacitor and a 100nF (0.1uF) ceramic bypass capacitor as close to the power and ground pins of the RN45 chip. Use MLCC X7R or X5R ceramic capacitors

    I am always forgetting about those pesky little capacitors :)
  • I used the RN42 with my BS2 before. You want to use the Tx, Rx, Cts, and Rts pins, so you can enter command mode etc. with the Bs2 I setup a laundry list of commands bytes, so I could display the commands on the debug terminal. What are you communicating with? These are only good for things like a boe bot etc. , doesn't really work with an IPhone maybe an android.
  • For those wondering as to the utility of the RN42 modules: we use the RN42 (and sometimes the RN41) to communicate with our Android host application and customers' (typically Windows-based) host applications. The Propeller takes care of driving our linear sensor, all of the hall-effect switches in our "keyboard" array, backlighting LEDs for those keys, the battery fuel-gauge, the humidity/temp sensor, the light sensor, the ID chip and the various multi-segment LED displays which provide feedback to the user. The Propeller also sends messages to the Android or Windows host application via USB and BT (both) at 115.2k. So, the Propeller has proven itself to be quite capable even in a "production" environment. On the aside, I now have units in the field for over 10 years still operating in very adverse conditions (full sun, in boats, getting thrown around) with no failures. Kudos to the Parallax team for making a chip that operates at high ambient temps.

    We have used the Propeller in conjunction with the RN42 with and without CTS/RTS. (ie, those signals have not been necessary for our purposes). Reset lines are highly advantageous, however.

    I don't have any experience with connecting the RN42 modules to an iOS device so can't comment there.

    @publison - 100ohm resistors are not necessary anywhere - they were in my posted schematic for a special purpose, but are not required for a typical connection from Propeller to RN42.


  • With Pbasic I send out "SEROUT TX\CTS, 84, ["$$$"] to get me in command mode, and "SERIN RX\RTS, 84, [STR response\10\13] for my buffer response. The 84 is my CON for 9600 baud. I started making a iOS app with Xcode but got busy with other things.
  • @DigitalBob
    doesn't really work with an IPhone maybe an android.

    It definitely works with an Android and I bet it can work with an iPhone also. Please refer to this thread: http://forums.parallax.com/discussion/172024/combining-2-threads-into-1-the-parallax-propeller-rn-42-bluetooth-and-android-apps#latest
  • I know android is possible because it explains it in the RN42 manual, but I don't have an Anroid to fiddle with it. Iphone no it just shows up in the bluetooth list. The RN52 pairs real easy with an IPhone, the 52 is mainly used for boom box music speakers etc.
  • With the iOS you need an app or terminal like a button screen to send commands to the RN42 that I'm aware of.
  • Or SSH term pro etc.
  • "Mike Green;c-1307653"]Check out the Learn tutorials, particularly the one on full-duplex serial connections since that's what the RN-42 uses. Although you can use handshaking (RTS/CTS) with Spin and the 4-port serial driver in the Propeller Object Exchange, the Propeller doesn't need it and the Full-Duplex-Serial driver in the C library and the Spin default object doesn't support handshaking.

    I haven't been able to find a sample program for the Propeller like the one for the Basic Stamp, but you should be able to translate it into C or Spin. Note that the RN-42 won't work with an iPhone, but should work with others like Android phones.[/quote]
Sign In or Register to comment.