• 0

Pmod BLE with Arduino Due: Example Code does not work properly



my goal of my project is to communicate with a BLE 4.2 Module in a smart Lamp with the help of an Arduino and the Pmod BLE. I am using the Arduino because I want to automate the process of connecting to the lamp. The Pmod is later supposed to send commands to the BLE Module of the lamp to turn it off and on or change the colors. I did not get really far yet. In fact I am still stuck with example code.

I'm using a Pmod BLE (https://reference.digilentinc.com/reference/pmod/pmodble/start) which is connected to an Arduino Due. The Serial Pins of the Due have 3,3V. I connected Ground of the Pmod to Ground of the Arduino, VCC of the Pmod to the 3,3V Power Pin of the Arduino and Rx of the Pmod to Tx1 of the Arduino (Pin 18) and Tx of the Pmod to Rx1 of the Arduino (Pin 19). As far as I know this is enough to let them communicate with each other. I never worked with an Arduino or anything like that before, so let me know if I already made a mistake.

I included the library (which can be found on the website of the link above) to the Arduino IDE and then connected the programming port of the Arduino with my Windows 10 Laptop. I tried the example code of the library, but I have problems with it.

Here is the Code:

#include "BLE.h"
BLE bt;

void setup()
  // Initialize Serial to print to Serial Monitor
  Serial.println("Begin program...");
  // Initialize PmodBLE. Serial1 is the serial port used to commuinicate with PmodBLE
  bt.begin(Serial1, 115200);

void loop()
  // Read data from PmodBLE, then print it to Serial Monitor
  // Send string to PmodBLE
  bt.send(Serial1,"Hi! I was sent using PmodBLE! :)");

Here is what I did after that:
1. I opened the serial monitor which said: "Begin program..." That's okay so far
2. I opened the App "BLE Terminal" on my Android Smartphone and connected to the Pmod
3. On the screen of the App I could read "Hi! I was sent using PmodBLE! :)". That's also good
4. I sent "hi" from the App to the Pmod.
5. Somtimes I got something written on the serial monitor right after that, but other times I had to disconnect the App from the Pmod first and then I got something on the serial monitor.

The problem is what I got on the serial Monitor. I attached a Screenshot because I was not abel to paste it in here.

I cannot explain why I get these symbols. The beginning seems right. I tried other baudrates but that was even worse and I tried other things than CR and somtimes I got other symbols.

I also tried using Cool Term on my Laptop. It has other symbols and sometimes it writes "Begin programm..." twice, for example like that:

Begin prograBegin program...
%CONNECT,1,5AF7BA28D3D1%%CONN_PARAM,0006e.......Ì.. ùÿÿÿÌ.. 5...²....P..G...Ì.. P. Y...A...P. Ì.. A`2˜Ý![Ù}...N

Has anybody an idea what is wrong?

What I really wanted to do in first place is to get into command mode with the Pmod connected to the Arduino. I did not find any examples how to do that. I tried to do it with the serial monitor but the command "$$$" does not seem to get through. So if you know any examples for that or if you have a hint how to do that I really would appreciate it.

Thanks for reading!

serial monitor.PNG

Link to post
Share on other sites

1 answer to this question

Recommended Posts

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now