Forum >Sending data between bluno nano and raspberry pi 2 with serial bluetooth module
Bluno General Arduino

Sending data between bluno nano and raspberry pi 2 with serial bluetooth module

userHead info 2017-06-22 09:11:34 12320 Views19 Replies
Im trying to send data from an arduino with integrated ble (bluno nano from DFRobot) to a raspberry pi 2 which has an hm10 ble module connected to its serial0 gpio14 and 15 pins.

Im currently using this sketch:
Code: Select all
float flow = 500.06;
void setup() {
Serial.begin( 9600 );}
void loop() {
if (Serial.available()>0) {
if (Serial.read() == 'R') {
Serial.print(flow)
Serial.write("\n");
}
}
}
and Im using this python to read it:
Code: Select all
#! /usr/bin/env python
import serial
from time import sleep
ser = serial.Serial(port='/dev/serial0',parity=serial.PARITY_NONE,
stopbits=serial.STOPBITS_ONE,bytesize=serial.EIGHTBITS,timeout=1)
# Wait to read from Arduino
while 1:
try:
time.sleep(10)
ser.write("R")
myData = ser.readline()
print myData
except KeyboardInterrupt:
exit()
This should make the raspberry send R to the bluno nano after 10 seconds of running the script. But I get blank lines in the raspberry terminal every ten seconds. I guess that is the print myData line, which is coming in blank. The bluno nano bluetooth led light is on, they are connected. What could be happening?

I have confirmed that anything I type into the arduino ide serial monitor shows up in the raspberry pi. But it appears the bluno is not receiving the data sent by the pi.
icon bluno.jpg Download(0)
2017-06-27 02:09:55 I guess this is a trick by the AT command. Please check its wiki AT command. There are two line: AT+USBDEBUG = ON/OFF AT+BLUNODEBUG = ON/OFF. Please check what is the status of the BLUNODEBUG? Is it ON? userHeadPic Grey.CC
2017-06-27 02:09:55 I guess this is a trick by the AT command. Please check its wiki AT command. There are two line: AT+USBDEBUG = ON/OFF AT+BLUNODEBUG = ON/OFF. Please check what is the status of the BLUNODEBUG? Is it ON? userHeadPic Grey.CC
2017-06-27 00:07:34 How about using a logical level converter, since the working voltages of R pi and Bluno Nano are different userHeadPic robert.chen
2017-06-27 00:07:34 How about using a logical level converter, since the working voltages of R pi and Bluno Nano are different userHeadPic robert.chen
2017-06-26 18:43:26 Yes it works with usb but I need to make it work over the serial Bluetooth userHeadPic info
2017-06-26 18:43:26 Yes it works with usb but I need to make it work over the serial Bluetooth userHeadPic info
2017-06-25 19:11:04 Have you tried to use USB serial instead of the GPIO pin 14&15 userHeadPic robert.chen
2017-06-25 19:11:04 Have you tried to use USB serial instead of the GPIO pin 14&15 userHeadPic robert.chen
2017-06-25 15:30:08 Thanks, but it didnt work. I tried 20, 100 and 200. userHeadPic info
2017-06-25 15:30:08 Thanks, but it didnt work. I tried 20, 100 and 200. userHeadPic info
2017-06-25 12:27:34 Try this code
Code: Select all
float flow = 500.06;
void setup() {
Serial.begin( 9600 );}
void loop() {
if (Serial.available()) {
if (Serial.read() == 'R') {
Serial.print(flow)
Serial.print("\n");
}
delay(20);
}
}
userHeadPic R2D2C3PO
2017-06-25 12:27:34 Try this code
Code: Select all
float flow = 500.06;
void setup() {
Serial.begin( 9600 );}
void loop() {
if (Serial.available()) {
if (Serial.read() == 'R') {
Serial.print(flow)
Serial.print("\n");
}
delay(20);
}
}
userHeadPic R2D2C3PO
2017-06-25 07:16:03 Try to put delay(100) at the arduino side to see if it helps! userHeadPic R2D2C3PO
2017-06-25 07:16:03 Try to put delay(100) at the arduino side to see if it helps! userHeadPic R2D2C3PO
2017-06-25 04:53:00 Ok I have made them connect via AT commands on serial. Im not using bluetooth protocol, just serial. And I can send from bluno and raspberry receives it. I just CANNOT send from raspberry and receive in bluno. Can you help me figure out why? userHeadPic info
2017-06-25 04:53:00 Ok I have made them connect via AT commands on serial. Im not using bluetooth protocol, just serial. And I can send from bluno and raspberry receives it. I just CANNOT send from raspberry and receive in bluno. Can you help me figure out why? userHeadPic info
2017-06-24 20:17:54 Um,not sure HM10 is compatible with Bluno Nano. We need to make sure they can be paired at the first place. userHeadPic R2D2C3PO
2017-06-24 20:17:54 Um,not sure HM10 is compatible with Bluno Nano. We need to make sure they can be paired at the first place. userHeadPic R2D2C3PO
2017-06-22 09:11:34 Im trying to send data from an arduino with integrated ble (bluno nano from DFRobot) to a raspberry pi 2 which has an hm10 ble module connected to its serial0 gpio14 and 15 pins.

Im currently using this sketch:
Code: Select all
float flow = 500.06;
void setup() {
Serial.begin( 9600 );}
void loop() {
if (Serial.available()>0) {
if (Serial.read() == 'R') {
Serial.print(flow)
Serial.write("\n");
}
}
}
and Im using this python to read it:
Code: Select all
#! /usr/bin/env python
import serial
from time import sleep
ser = serial.Serial(port='/dev/serial0',parity=serial.PARITY_NONE,
stopbits=serial.STOPBITS_ONE,bytesize=serial.EIGHTBITS,timeout=1)
# Wait to read from Arduino
while 1:
try:
time.sleep(10)
ser.write("R")
myData = ser.readline()
print myData
except KeyboardInterrupt:
exit()
This should make the raspberry send R to the bluno nano after 10 seconds of running the script. But I get blank lines in the raspberry terminal every ten seconds. I guess that is the print myData line, which is coming in blank. The bluno nano bluetooth led light is on, they are connected. What could be happening?

I have confirmed that anything I type into the arduino ide serial monitor shows up in the raspberry pi. But it appears the bluno is not receiving the data sent by the pi.
userHeadPic info