In this tutorial we will use an Arduino Beetle BLE to make a simple wearable device for …your pet! My cat is the model of this wearable project.
Here are the main functions to implement:
-The wearable device will be built around a small jacket that the cat can wear.
-A light strip on the jacket will be light up with our cat’s steps (to put dog walkers to shame)
When the wireless jacket is paired with your phone via Bluetooth, it will control the light strip to flash on and off so that you can locate your pet quickly.
With a MP3 module integrated into the device, you can play your voice to call your cat from far away, or play music to entertain it.
Check out the following video:
Step 1: Components
Digital RGB LED Strip 60 LED - (3m)(weatherproof)
LilyPad LED Micro - White (5pcs)
Step 2: The Flowchart
It demonstrates how our program should work.
This device is wirelessly controlled by the app “GoBLE” designed by DFRobot. Select mode using START and SELECT button. In normal mode, turn on the controller interrupt to check the cat’s movement while testing the reaction of the light strip and its effect. In audio mode, turn off the interrupt program, to make sure the music is continuous and you can better control other effects of the light strip.
The buttons are displayed as the second picture:
Step 3: Circuit Diagram
Step 4: Procedure of Making- Step 1
Buy your cat a stylish jacket such as this:
Step 5: Procedure of Making - Step 2
Pre-set the general location of the unit
Step 6: Procedure of Making - Step 3
Sew the shock sensor onto the shoulders
Step 7: Procedure of Making - Step 4
Sew the speaker on to the jacket
Step 8: Procedure of Making - Step5
Sew the speaker
Step 9: Procedure of Making - Step 6
Solder the light strip
Step 10: Procedure of Making - Step 7
Sew the light strip, the mode instruction LED light and the switch module beside the pocket
Step 11: Procedure of Making - Step 8
Solder the positive lines together and use heat-shrink to insulate the connections.
Step 12: Procedure of Making - Step 9
Wire in 330 ohm resistors on each I2C line of the MP3 module, using heat shrink to insulate the connections.
Step 13: Procedure of Making - Step 10
Solder all the electronic connections
Step 14: Procedure of Making - Step 11
Solder other separate units and the Bluno Beetle board to finish the electronic connections. Hide any circuits away in the jacket pocket.
Step 15: Program Analysis 1
How to use Software Serial Ports
The Bluno series controller has to occupy pins D0 and D1 during Bluetooth communication. It also uses D0 and D1 pins when the USB serial port is in use and a program is uploading. If your device is already paired via Bluetooth, you will need to unbind the connection before you can upload code to the controller.
When using the GoBLE APP to communicate with the controller in real time via Bluetooth, it is suggested to use software serial-port rather than hardware serial-port (D0, D1) if there is any device needs to have serial port communication with the controller.
Use the virtual serial port in communication; you need to declare a software serial-port bank before the program.
#include // software serial-port bank is the standard pool of the official Arduino, so there is no need to import this bank.
In this example, in order to declare an object of the software serial-port, we use pins D4, D5 as the RX and TX terminal respectively.
SoftwareSerialmySerial(4, 5); // RX, TX Among which mySerial is the name of the software serial port you defined
Set up the baud rate of the software serial port mySerial.begin (9600);
Step 16: Program Analysis 2
How to Change the Bluetooth Device Name
For search convenience purpose, we can give a special name such as “ＤＦＣａｔ＿Ｓｕｉｔ”for our Bluetooth device to the wearable device through the AT instruction.
We can change the generic Bluetooth device name to something more specific for our purposes. This will avoid any confusion if there are lots of different Bluetooth devices in close range. To change the Bluetooth device name, we will need to use some AT commands.
1. Open Arduino IDE
2. Select Menu > Tools > Serial Port and select the appropriate device
3. Open the serial port monitor (click the button on the top right corner of the window)
4. Select No line ending (①) and 115200 baud（②）from the two drop-down menus
5. Type in +++ in the input box （③）and click send （④）
6.If you receive Enter AT Mode (⑤), it means you have entered into AT instruction mode and can now issue AT commands.
7. Select “Both NL & CR”(①)and 115200 baud（②）from the two drop-down menus
8. Type in AT instructions in the （）input box: AT+NAME= DFCat-Suit and click SEND（④）
9. If BLE can be successfully applied, the interface will return back to “OK”（⑤）
Now, the simple pet wearable device is done! Of course you could make a similar one for your dog!