Nowadays, allmost every person has a smartphone and they come with sensors that we can use in our inventions, like IMU, GPS, Cameras, etc. And we can obtain a Bluetooth module for around $4.00 USD.
So, lets begin with this toturial:
Materials:
- HC-06 Bluetooth module
- Android phone
Process:
First we are goin to enter to App Inventor, this is a MIT website to create android apps, you are able to log in with your Google account or register with another email.
Once you're logged in, go to start new project. Now that you are in the window of creation you could see a Palette where sensors, buttons and other functions can be added to our app.
We are going to add a ListPicker, WebViewer, Bluetooth Client, Clock and a Location Sensor. Your components and preview have to look like the next screenshot.
On my app I configure the ListPicker like a conecction button, all you have to do is to click on the component and change its properties.
You can change colors, dimensions and another things if you want, but today we are going to make it a little simplier. Now, we have to do the code, don´t worry, this website allows you to program buttons and sensors with blocks. I am going to put some screenshots of each part of the app, you can get blocks from the right corner of the main window. And all fuctions are on the blocks window.
Now the programing:
Connection button:
Clock:
In this image we can see our message that is sended trought our bluetooth module. You can make a script for arduino or python for a Raspberry Pi board, also this could work for BeagleBone.
Now, we can download our app:
Finally, I will leave here an example of how the information can be recieved on an Arduino board.
What an interesting use for a smartphone.
Do you code Python? It would be interesting to connect to a Raspberry Pi.
Of course, it´s a little bit the same code as on arduino. You just have to connect the bluetooth module to the UART pins into the Raspberry Pi board.