Year 12 Design and Technology Project

Hello there,
I am writing to seek your kind help with my daughter’s year 12 design and technology project. My daughter is developing a SIDS monitoring device. A device is to be worn on a baby (slotted into a pouch that is sewn on baby pants) and when the baby flips over onto its stomach it sounds an alarm. The idea is for the bluno nano to communicate wirelessly to the raspberry pi, which is located in the same room. The raspberry pi will then wirelessly communicate with a second raspberry pi connected to an alarm. The second raspberry pi/alarm can be placed in another room (eg parents bedroom room).
Under the guidance of her teachers, she has purchased 2 raspberry pis (model 3) and a bluno nano (with bluetooth). The bluno nano has been successfully configured to switch on a small light when it is tilted 90 degress or more. Nothing more has been progressed on the project. Just a couple of days back her teachers advised that they can’t help any more as they don’t know how to configure/program the raspberry pis. They asked her to go out on her own and find help. This is why I’m on this forum. I need your help to guide my daughter to completion of this project. Both myself and my daughter are completely new to this technology. We are true beginners. Can you please help ? Thank you Maria

Hi Maria,

Sounds like a great project underway. It might be worth starting with our online Raspberry Pi Workshop, you’ll get a great walk through RPi and how it works in general.

I’m confident you’ll be a lot closer to coding by the time you’ve worked through that. Skip the IoT and GUI sections, but definitely dig deep into the Python side of things. You’ll at least have a good grounding on how to get started, and report back once you’ve got some script underway!

Thanks very much Graham for your tips. I’ll look into the online workshop tomorrow. I’ll let you know how it goes. Good night !

Cheers, Maria

Hi all,

I have gone through the Raspberry Pi online workshop for beginners. This contained a lot of great information. I have successfully connected my Raspberry Pi 3 to the Bluno Nano using Bluetooth.
I am now trying to read data from the Bluno Nano, but not having much success.
The Bluno Nano is connected to a Gyroscope BNO055. Can you please provide more guidance on how I can read the data from the Bluno Nano on the Raspberry P1, such that when Gyroscope is turned 90 degress or more, it triggers an alarm on the Raspberry P1 3. Any guidance would be greatly appreciated. Thank you

Hi Maria,

Here is a tutorial that will explain how to interface between an arduino and the Raspberry Pi over Bluetooth. I think you will need to write a Python script to read the messages coming in over Bluetooth.

This tutorial is written for older model Raspberry Pi’s that didn’t come with Bluetooth installed, so ignore the dongle part your Bluetooth is built in.

You said that you have gotten a light to turn on when the Arduino is tilted, do you have a Serial.print() command in your Arduino code to send that over Bluetooth?

Thanks Stephen for your quick reply. I’ll go through that tutorial tonight.

No, I haven’t done any coding yet to try to get the arduino and raspberry pi communicating.

So far, Been trying to learn and search website and videos that might give me example code. Ive made a couple of attempt to get started with coding, but it’s been a little more challenging than expected. The videos show commands on the raspberry pi terminal and when I try to replicate I don’t get the same result. I then have to figure out why.

I google again and find out that I have to do other changes eg, change an ini files. Overall, I am just a beginner and it’s taking me a very long time to make tiny steps forward.

My daughter is getting very worried that she finish on time. I’ll have another stab at it tonight.

Thanks for your help.

Cheers, Maria

1 Like


Is there a way that you can simplify the project? You will need to be able to code in Arduino to program the position sensor, and program in Python to make a program on the Raspberry Pi to read incoming Bluetooth.
That’s a lot of stuff to learn on a time crunch, and this is an intermediate level programming challenge you’ve given yourself.

I found another good tutorial for you thats all about connecting your bluetooth Arduino to a Raspberry Pi:

You could look into sending MIDI signals over Bluetooth from your Arduino and then using Sonic-Pi on the raspberry pi to turn them into sounds. This is still a very complicated solution though.

A way you can still achieve the goal of this project is to use something simpler, like the Circuit Playground Express (it will be back in stock any day now). You can program it with dragging and dropping blocks in MakeCode. We have 18 Tutorials on how to use it and an online workshop. It has a built-in accelerometer that can be used to detect the baby’s position and a speaker on board that can be the alarm. It wouldn’t be transmitted to another device, but it would be pretty close to the proposed project if the Bluetooth doesn’t come together in time. This is a board that’s made for beginner programmers.

1 Like

Thanks Stephen for letting me know about the Circuit Playground Express. Will definitely share that with my daughter and we will keep in mind as an alternative in case we don’t get the Bluetooth communication between the Arduino and the Raspberry PI working.

Thank you heaps for pointing me to the website . This was very useful.
I decided to try the sample code to see if I could establish the bluetooth connection two ways.

I came across a few errors with the sample code:

Error 1. sudo apt-get install bluetooth bluez-utils blueman doesn’t work. The bluez-utils seem to be obsolete.
I am wondering if this obsolete since the new Raspberry Pi which has built in bluetooth ?
FYI…when setting up the Bluetooth I had installed:
sudo apt-get install pi-Bluetooth, in addition to
sudo apt-get update,
sudo apt-get upgrade -y,
sudo apt-get dist-upgrade -y
sudo rpi-update
I’ve also run: sudo systemctl start bluetooth and sudo systemctl enable bluetooth.
With the above, I was able to invoke Bluetooth Manager and connect some devices. I am able to see “Bluno” come up in Bluetooth Manager as a device. Its status is connected, although the pairing was unsuccessful.
I have also connected to a Bluetooth keyboard and that is working fine with the Raspberry Pi.

Error 2. When I tried to run the sample raspberry python code, I received a few errors relating to dev/rfcomm1. That is the line:
bluetoothSerial = serial.Serial( “/dev/rfcomm1”, baudrate=9600 )

I followed the instructions, so tried to set up rfcomm, but I got an error. Not sure if I need rfcomm1 to be setup anyway, since Raspberry Pi3 has built in bluetooth ?? Plus “Bluno” comes up as a connected device, so not sure whether to use Bluno instead of rfcomm1

I then thought to replace “/dev/rfcomm1” with “ttyAMA0”. I recall reading that the Bluetooth port is named ttyAMA0. I ran the program again and it did not error this time. It just stopped on when trying to output to the bluetooth.
bluetoothSerial.write( str(count) ). That might be expected since I haven’t yet setup the code for the Arduino. Will do that tonight.
I’m wondering whether you think I’m on the right track or not. Is it correct to use ttyAMA0? I’m wondering if I need to disconnect the bluetooth keyboard so that the port is dedicated and connected to one device only. I am also wondering whether I should just specify the device name “/dev/Bluno”. I will test out a few things tonight, once I have the Arduino code running.
Thanks for all your help and guidance. It’s great to be able to talk to someone about my progress !!

I think you are on the right track! You shouldn’t need to use Bluez since the Raspberry Pi 3 has built in Bluetooth. Since you are connected already, its probably just a matter of identifying the correct port like you did. A big portion of the last couple tutorials I sent are devoted to getting bluetooth working, but you are already past that step.

Here is a quick tutorial for setting up the bluetooth if you run into problems, but I think you have already worked this part out:

I think next step is to setup your Arduino to transmit data over bluetooth.

Good luck!

1 Like

Hi Stephen,
Thanks once again for sharing the CNET link for setting up Bluetooth. I was able to execute those commands and see the bluno and raspberry p13 were successfully paired and trusted.

I picked up sample code and modified it to very minimal functionality to prove that data could be send successfully from the bluno to the raspberry pi. Below are my programs:

Arduino Sketch (note this seems to work, ie the green light flashes on the breadboard):
#include <Wire.h>
int ledPin = 13;

void setup(void)
pinMode(13, OUTPUT);

void loop(void)
int count = 1;

void blinkLED(int count)
for (int i=0; i< count; i++)
digitalWrite(ledPin, HIGH);
digitalWrite(ledPin, LOW);

Python 3 (successfully compiles and runs, except nothing is read from the Bluetooth serial port:
mport serial

#bluetoothSerial = serial.Serial( “/dev/serial0”, baudrate=9600 )
bluetoothSerial = serial.Serial(
# port="/dev/serial0",
baudrate = 9600,
print ("About to read from bluetooth channel ")
blunostr = (str(
print (blunostr)
print (“Finish”)

I then run the program and my output is as follows:
pi@raspberrypi:~ $ sudo python
About to read from bluetooth channel

pi@raspberrypi:~ $

I have done so much googling and so many different things.
I swapped “/dev/ttyAMA0” for /dev/Serial0
I’ve run in the terminal sudo rfcomm bind 0 50:65:83:94:28:54

Can you see if I am doing anything wrong in my reading and writing to the serial port ?
Thanks again. Cheers, Maria

Hello again,
I just wanted to add couple more points:
when I enter the terminal commands:
sudo bluetoothctl
power on
agent on
scan on
pair 50:65:83:94:28:54
connect 50:65:83:94:28:54
trust 50:65:83:94:28:54
After entering scan on the raspberry pi is very slow. Next step of pairing does not work. It asks for a pin, and I enter default value 1234, but it fails. However next steps of connecting and trusting succeed.
Thanks again.

I don’t have any quick answers, but I am familiar with the hurdles of using bluetooth this way. If someone doesn’t step in to help in between, and you figure it out on your own, then please do report back with what worked!

Hi Maria,
I am not familiar with setting up a arduino to raspberry pi Bluetooth connection, however it looks like you may have set a 1s timeout for your serial connection. I would assume this may not be enough time for the connection to setup and receive characters (if any are successfully sent).

To fix this try changing “timeout=1” into “timeout=None”. Here are some references on the python serial interface:

I’ve previously setup a Bluetooth connection using a raspberry pi zero to a android phone using the command line (i.e. not python) utility “rfcomm”, however I cannot find a useful resource that I previously used and I was only writing from the pi. Unfortunately this was also a bit of a trial and error process.

Try the paired-devices command while in the Bluetooth console (sudo bluetoothctl), to see if the device is paired correctly.

Thanks very much Benjamin for that info. I’ll give that a try and read those links tonight. I’ll let you know how I go. Thanks again.

Sorry to hear it’s not working for you, let’s try a slightly different approach. The tutorial that we were talking about earlier has a pretty good test and python sketch:

Try this for the Bluno:

int ledPin = 13;
void setup() {
  Serial.begin( 9600 );    // 9600 is the default baud rate for the serial Bluetooth module
void loop() {
  // listen for the data
  if ( Serial.available() > 0 ) {
    // read a numbers from serial port
    int count = Serial.parseInt();
     // print out the received number
    if (count > 0) {
        Serial.print("You have input: ");
        // blink the LED
void blinkLED(int count) {
  for (int i=0; i< count; i++) {
    digitalWrite(ledPin, HIGH);
    digitalWrite(ledPin, LOW);

Try this for the Raspberry Pi, make sure Serial is installed:

 sudo apt-get install python-serial

Then try this python program:

#! /usr/bin/python

import serial
from time import sleep

bluetoothSerial = serial.Serial( "/dev/ttyAMA0", baudrate=9600 )

count = None
while count == None:
        count = int(raw_input( "Please enter the number of times to blink the L$
        pass    # Ignore any errors that may occur and try again

bluetoothSerial.write( str(count) )
print bluetoothSerial.readline() 

Hi Stephen,
Thank you for sharing that code. I appreciate your efforts.
I tried this code and did not succeed. I decided to try to seek more help. At my work I was very lucky to find someone who has worked with Raspberry Pis and is far more technical than me. He is very kind and has been helping me with my project over the last week. He has progressed further, but unfortunately it is not working entirely yet.

He is using gattool commands at terminal to observe the serial data being received. With this tool the data appears to be received fine, however, when trying to receive the same data using Python, the same data value is showing up differently. He has provided me this detail:

pi@raspberrypi:~ $ sudo gatttool -b -I
[LE]> connect
Attempting to connect to
Connection successful
Notification handle = 0x0025 value : 32
Notification handle = 0x0025 value : 32
Notification handle = 0x0025 value : 32
Notification handle = 0x0025 value : 32
[][LE]>char-read-hnd 0x0025
handle : 0x0025 value : 01
Notification handle = 0x0025 value : 32
Notification handle = 0x0025 value : 32
So the problem here is , Notification handle listener ‘listens’ to the serial data and returns the value( 2 -> Hex:32) every 1 second from Bluno (as programmed in Adurinosketch).
But when I try to retrieve this value through the command char-read (tried both by handle & uuid) it always returns 01 ?!!!
Ultimately I want to retrieve this value in the Python code (using Pexpect for this)

Do you have any suggestions for solving this ? Your help is greatly appreciated.

Hi Maria,

There’s a whole bunch of tools I don’t have enough experience with to value-add, but I’d be all ears if you/someone tinkers together a solution!

Hey Maria,

Unfortunately we have moved into an area that is beyond my ability to help. I’m happy to continue helping however I can but this problem you have has left me stumped.

I think that the command char-read is a function of gatttool, so it wont work directly within Python. As far as returning 01 isn’t that the number that your Arduino is transmitting? The number of blinks is set to 1?

Hi Stephen,

Thanks very much for getting back to me and for trying to help.

My work colleague has been able to help me with my issue. I will get back to you soon with more details. I am yet to see his code updates.

Will get back to you in a couple of days.

Thanks again.




I wish I could have been more help! Please do share any solutions you find so we can all benefit from your troubleshooting! :grinning: