Notifications
Clear all

BLE Communication between 2 boards

14 Posts
2 Users
3 Reactions
98 Views
(@marcelo)
Member
Joined: 7 months ago
Posts: 9
Topic starter  

Hi, Everybody!

I would like to get help from you!

I'm trying to establish a BLE communication between 2 boards Arduino Nano 33 BLE.

Both examples, ArduinoBLE==>CENTRAL==>SCAN and ArduinoBLE==>PERIPHERAL==>LED, works well.

But when I try the example on DroneBotWorkshop video "Arduino Nano 33 IoT Board" - (minute 32), using LedControl example in one board plus the LED example on another board (as described on video), does NOT work.

I suspect the issue is related to the "big number" 19b10000-e8f2-537e-4f6c-d104768a1214, since the code compile, is uploaded to both boards, but the boards do not connect.

Does everyoneelse had the same problem?
Any suggestion I can do to solve this?


   
Quote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 4 years ago
Posts: 7375
 

@marcelo I just wanted to point out that there is an article that goes with the videos. It can be found by clicking the ..more under the videa and it is the first link. I find it a lot easier to have a document rather than constantly rewinding a video.

When you refer to either a video or an article providing the link makes it easier for us to follow along.

When you say something does NOT work, what exactly do you mean. Is there an error message, or is there nothing appearing where it should be. NOTE, the Serial port can be a little flaky, kill it and re-activate it a few times to make sure nothing is happening.

The video I found is at VIDEO  but I will not watch it, rather I will read the article at HERE.

I just want to check that you have loaded the sketch called LED.ino on one board, and on the other board the sketch called LedControl.

I don't have two Nano 33 BLE boards, but I do have a few diferent Nanos so will try each one and see what happens.

Try to get more information, and please use screen grabs where needed, and copy/paste the actual code if needed. See the help files on the right side of the forum page to learn how to paste any code. PLEASE format it so it can be easily read, the Arduino IDE has a Tools/Auto Format tool to do it for you.

 

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 4 years ago
Posts: 7375
 

@marcelo I found two NANO boards, one is a NANO 33 IoT the other is a NANO ESP32. I quickly loaded the sketches, didn't bother with the PB or LED as that is not needed to prove they are working. Attached are the screen grabs of each.

Screenshot 2024 07 02 at 19.29.17
Screenshot 2024 07 02 at 19.30.10

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
ReplyQuote
(@marcelo)
Member
Joined: 7 months ago
Posts: 9
Topic starter  

@zander , thank you very much for your time and answer.
This was my first post here in forum and apologize me for some mistakes. I will consider your advices.

Posted by: @zander

I just want to check that you have loaded the sketch called LED.ino on one board, and on the other board the sketch called LedControl.

Yes, I have loaded the sketch called LED.ino on one board, and on the other board the sketch called LedControl as you can see on images attached.
I did NO modifications on the sketch examples. They are exactly as original.

I can see only the first output message on SerialMonitor for each sketch, as images attached.

I wait up to 30 minutes for 2 boards to connect and nothing happens. I reseted many times, getting always the same result (only the first message on SerialMonitor).

I am using 2 Arduinos Nano 33 BLE boards.

Do you think it will help if I send the code here?

I am on this issue for 3 days now. I know the sketch works for everybodyelse and it will work to me also (even if I have to buy another 2 boards and another computer). kkkkk

Thanks again....

SerialMonitor LED ino
SerialMonitor LedControl ino

 


   
ReplyQuote
(@marcelo)
Member
Joined: 7 months ago
Posts: 9
Topic starter  

I was very hopeful when I plug the Nano 33 BLE board into my RaspianOS computer (Raspberry Pi4. Just to change my tests from windows to another OS) and got the message that I should install the Arduino Mbed OS board package since the Arduino Nano BLE board was obsolete.
So I installed this new board package, changed the board to it, loaded the sketch and... nothing changed.
Very frustrating.... but still trying.

 

Nano 33 BLE message

 


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 4 years ago
Posts: 7375
 

@marcelo I had both boards plugged into my Mac with both sketches running. I did get a message about updating boards which I clicked OK to do. Do screen grabs, NOT photographs. Open the Serial monitor, first, the LEDControl monitor should show lots of activity. You need both sketches running at the same time, I don't see two USB connections, and I don't see both sketches running at once.

If you have two computers, then that might be easier to set up, but it works for me on one Mac.

It works for everyone else, your boards are not defective, not sure if you have the right board software but if you do, then it is something in your procedure. I have heard that running two copies of the IDE on Windows is tricky but since you have one Win and one Pi it should work.

My best guess is you have not loaded the boards properly. On my Mac it told me and gave me a yes/no to install. Of course I said yes and everything worked. Here is a screen grab of my boards.

Screenshot 2024 07 03 at 06.41.36
Screenshot 2024 07 03 at 06.43.49
Screenshot 2024 07 03 at 06.45.02

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
ReplyQuote
(@marcelo)
Member
Joined: 7 months ago
Posts: 9
Topic starter  

@zander, Yes, yes, yes!!! It works!!!
You were precise in your diagnostic for me. Thanks a lot for this.
I really never had both boards conected to a USB port on IDE, at the same time.
I was always disconnecting one board, powering it with an external power supply and then conecting the 2nd. board to IDE using the computer USB.
Now I plugged one board on my Arduino windows IDE and the 2nd. board on my Arduino RaspbianOS IDE.
It worked smooth and very fast connection!!
I am so happy this is solved now!!! Better sensation than make a big sell on company! 😀

I thought it should work with just the external power, but I saw it didn`t.
I don`t know why this happens, but I will search to find the answer. Any suggestion? 😉

My final project for this is an "stroke" counter for pile driving machine (used in civil construction)
I plan to use the Nano 33 BLE builtin IMU to detect the strokes (stroke rate is about 1 per second).
Then I plan to use the BMP390 to calculate the pile depth.

As soon as the project progresses further, I intend to open a topic to share it here in this forum.

Again, thanks a lot!!!

PS: I tried to change the photo to screen grab, but I didn´t find a way to edit the post.
For now on I will always use screen grab insted display image.


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 4 years ago
Posts: 7375
 

@marcelo Good to hear. Once you upload the sketch, it should work with any kind of USB power. These types of boards can be finicky at times especially Bluetooth so resetting via the reset button and/or unplugging and plugging back in is often needed. I was working with a regular NANO earlier today, and I was resetting fairly often to see ALL the output on the Serial port

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
ReplyQuote
(@marcelo)
Member
Joined: 7 months ago
Posts: 9
Topic starter  

@zander , definitely here in my case, the boards do not establishes communication between them if not attached on both computer with Arduino IDE running and the board must be 33 BLE (in my case). 
I tried to use only the power supply using 2 walls plugs, but it did not work. I reset the 2 boards more than 20 times and unplugged and plugged again +- 6 times.
For now only works with both boards connected to IDE.
But that is not so important. I will try to find on sketch was could be.


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 4 years ago
Posts: 7375
 

@marcelo Hmm, not sure why that should happen. Once the sketch is uploaded the USB only supplies power.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
ReplyQuote
(@marcelo)
Member
Joined: 7 months ago
Posts: 9
Topic starter  

@zander , OK, thanks for spending your time with my issue.
Anyway, te project is still far from needing to be powered only by batteries


   
Ron reacted
ReplyQuote
(@marcelo)
Member
Joined: 7 months ago
Posts: 9
Topic starter  

@zander, the problem is solved!!

I just commented the line

    while(!Serial);

on both scketches.

The script was looping at this line, waiting to ensure that the serial communication is properly established. This never happens when power is from a external power supply.

Now both boards are working with external power supply.

Thank you! You helped me a lot.

 


   
Ron reacted
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 4 years ago
Posts: 7375
 

@marcelo Good man! I really appreciate two things, the first is your perseverance. That impresses me because I am known as a pit bull with a problem. The other is the fact you reported back. So many do not and we don't learn anything.

Now I must apologize for not noticing that. The purpose of that statement is to ensure the Serial port (connected to your screen) is working which of course it can't if not connected. 

What you will need to do in your future project is come up with another way to communicate. I have used MQTT, but you could also use Bluetooth, WiFi, or the Arduino Cloud. None of those sound very practical from what you have described re your pile driver project.

Good luck.

EDIT: Please go back to your original post about this and mark it as solved.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
ReplyQuote
(@marcelo)
Member
Joined: 7 months ago
Posts: 9
Topic starter  

@zander, I had great results and learning in this my first participation on forum, especially for your support and dedication.
Just to mention what I learned, besides technical matters: 

  • Being more clear and describe the problem with details
  • Do not use description if can be accessed with a link
  • Use screen grap instead of photos
  • when finished, mark post as solved

All that, plus techincal matter, tanks to you!!

I will mark it as solved now.


   
Ron reacted
ReplyQuote