top of page
Writer's pictureraiscotenlerealsim

Arduino With RN4870 1: How to Implement Peripheral and Central GAP Roles



The UART Transparent Service for Serial Data allows an easy way to link 2 modules together. This can be considered a serial cable replacement, however, if this is all you need you may be better suited with the HM-05/06 or HM-10.


The RN4870/1 is available is a few different sizes/configurations. With shielding, without shielding, with antenna, without antenna, all pins available, only basic pins available.Image from the Microchip RN4870/1 data sheet.




Arduino With RN4870 1



These modules are more expensive that the common hobbyist modules like the HM-10 but they far more advanced, well supported with full data sheets and a user forum. Most questions, if not all, will have already been answered on the forum.


RN4870 product overviewUser guide, data sheet, firmwares and update tool. Same page as above, click the Documents tab and scroll down.Technical details. This is a website with lots of details. Use the menu on the left.


Firmware 1.30 comes with a set of default services and characteristics built in and we can use these to try out making a connection. I am keeping it simple and using the Arduino IDE with the same serial adapter and BLE Android app as above. The RN4870 is on and in data mode.


The RN4870s have a transparent UART layer built in. This means it is easy to get them connected and start sending data. This is very similar to how the HM-10s (and similar modules) work, and, if this is all you need you might as well go with HM-10s. They are cheaper and come on hobbyist friendly breakout boards.


To get started I am using modules connected to the same computer with usb to serial adaptors. The same ones as above. One of the modules is on COM 7 and the other is on COM 8. I am using the module on COM 7 to initiate the connection. Everything is manual. The modules I am using have firmware 1.30.


Release notes are included with all firmwares but the notes only include the changes for the latest version (no history). If, like me, you are jumping a few versions you will need to check the release notes for each firmware version to know what all the changes are.


I have been reading all your posts on the HC-05, HC-06 and now the RN4870. I have a piece of electronics that uses an HC-06 to link to Android apps and Windows software. But it will not of course link to anything iOS. Is it possible to set up an Arduino with an HC-05 as a master and link to the HC-06, and then pass the data thru to the RN4870 so that iOS can at least recognize the RN4870.


If you have access to the device it may be possible to replace the HC-06 with a BLE module such as the HM-10 or RN4870/1or any module that talks UART. This assumes the device is not controlling the HC-06 and the HC06 is simply acting as a serial bridge.


I have also followed the instructions in the Microchip RN4870-PICtail-UserGuide.pdfusing the same breakout board with some pots, LED, switch, added instead of the PICtail board. Again, everything works as expected, including communicating with BLESensorApp on an Android smartphone.


I would now like to move on to my real objective, which is to connect a digital temperature sensor to my breakout board and capture the readings on my PC.I do not foresee any difficulties at the board end, as I am well able to deal with the hardware, and expect to be able to program the RN4870 as required ( Or alternatively to write a script ).


My problem is what to do at the Windows PC end. Neither of above terminal emulators appears to meet my objective, i.e. to capture temperature readings and present them on screen, and also to save them to a file. I should mention that I plan to capture readings say every 15 mins over a whole day, and save them together with time and date stamp.


A while ago I started to look for a suitable app but got side tracked with work, decided to create an Android app and never looked at VB again. Visual Basic (or C or C++) should not be too hard for you and a google search brings up quite few resources about the Windows BLE services. Not sure how complex using BLE on Windows is though. I suppose it depends on how much of the work the services do for you.


What was the issue with the HM-10s? I have moved away from these now but in the past I used them in some fairly wifi polluted environments without too much issue. The only thing I really noticed was that the distance they could be used was reduced.Without really knowing, I suspect if you have issues with the HM-10 you are likely going to have issues with other BLE modules.


But I am again stuck at this point, and have no clue about how to get the sensor data on to my PC. So I will follow up on the Silabs links you give, and also try the Microchip forum, although my past experience with that is not very good.


I followed your instructions with a bit of variation using an adruino as a usb to serial port and am having some troubles. I get no communication from the board and any commands i send get no response from my computer. The led flashes the correct sequences when i try to connect via bluetooth (cant communicate there either) or ground pin 18 so i assume the board is working correctly and im just unable to communicate with it. i also tried reflashing the board but the connection failed using isupdate.exe. is there an extra step to connect this board using an arduino? i did the standard ground to reset on the arduino and same tx->rx and rx->tx but still get no response.


Hi Martyn,Thanks for the description. I had a play with 20 of RN4871 modules and found them horrible. They hang continuously, factory reset zeroed mac in 2 of the units and 2 never properly communicated. Horror! Do you know any other alternative in the smallest form-factor?


DO NOT use the CLICK BOARD as the Click board does NOT provide ANY power conditioning what so ever. MY CLICK boards came with v1.18 (certain death revision) AND did not inmplement any filter capson the CLICK BOARD even tho the cap was drawn on their schematic (certain death^2).


Hey Martyn,i try to work withe the rn4871 BLE. Over the scanner app i can send commands to the BLE modul. My next step is to create a App withe MIT App Inventor 2 but i have not enough know-how in App-programming. I search for a simple LED ON/OFF function. do you have some experience withe the combination of rn4871 and your own android app?


Hello, I am trying to connect my arduino uno to the RN4871 and still have problem can you plz share how did you connect italso when i try to connect rx, tx of the arduino with the rx tx of the ble the module stop working


My only remaining question is: am I still able to send/receive UART data through the wireless bridge while simultaneously being able to toggle the GPIOs of the remote bluetooth module? If so, I think I will go with this alternative for OTA updates of my STM32411.


Arduino is connected to PC with USB so can be accessed via Serial I/O and Port. You first need to initialize serial and define port in you unity's Start() method so it can listen to. In my code i am listening to the port from Update() method. If you want to send input to arduino see the method SerialCmdSend(string data) which takes argument as string value. You can define this according to your need or change it in arduino code.


The Bluefruit LE Connect app provides iOS & Android devices with a variety of tools to communicate with Bluefruit LE devices. These tools cover basic communication and info reporting as well as more project specific uses such as Arduino Pin Control and a Color Picker.


Thanks to the application, you should be able to discover the board (named testPeriph_XXXX), connect to it and get the list of services it provides. The service created by the above sample code, the one with AD11CF40063F11E5BE3E0002A5D5C51B UUID, lets you read the temperature value generated by the board sensor, thanks to the read characteristic (BF3FBD80063F11E59E690002A5D5C501 UUID). And it lets you modify LED color, thanks to the write characteristic (BF3FBD80063F11E59E690002A5D5C503 UUID): send three bytes, e.g. 00FF00 to set green color at maximum intensity.


We also use third-party cookies that help us analyze how you use this website, store your preferences, and provide the content and advertisements that are relevant to you. These cookies will only be stored in your browser with your prior consent.


1. Transfer Multisort Elektronik sp. z o.o., ul. Ustronna 41, 93-350 Łódź hereby informs you that it will be the controller of your personal data.2. The personal data controller has appointed a data protection officer, who can be reached via email: dpo@tme.eu.3. Your data will be processed on the basis of point (a) of Article 6(1) of Regulation of the European Parliament and of the Council (EU) 2016/679 of 27 April 2016 on the protection of individuals with regard to the processing of personal data and on the free movement of such data and the repeal of Directive 95/46/EC (hereinafter referred to as: GDPR) , in order to send to the provided e-mail address, an electronic news bulletin of TME.4. Providing data is voluntary, however, it is necessary to send an information bulletin.5. Your personal data will be stored until you withdraw your consent to the processing of your personal data.6. You have the right to access your personal data and request it to be corrected, deleted, or limit its processing;7. To the extent that your personal data is processed on the grounds of your consent, you have the right to withdraw that consent. Withdrawal of consent has no bearing on the legitimacy of processing that was performed prior to the withdrawal.8. You also have the right to file a complaint to a supervisory data protection authority. 2ff7e9595c


1 view0 comments

Recent Posts

See All

Download de sudoku offline

Como baixar o Sudoku offline e aproveitar o jogo de quebra-cabeça em qualquer lugar Sudoku é um dos jogos de quebra-cabeça mais populares...

コメント


bottom of page