Software apps and online services
Most TinyShields can be used with other TinyShields without issue, as can be seen with our compatibility matrix, but there are some that won't work together at all, or need a workaround.
Today's tutorial highlights one of these workarounds to allow the Servo TinyShield to work with the BLE TinyShield, so you can do something cool like use your phone to turn a servo motor across the room. Some applications may include DIY pet (or person) feeders, and tiny robots.
Note that BLE is not the best for high speed, low latency control- for example, what might be needed for a fast radio control plane. Connections typically default to 20 updates per second, which is great for many other applications!
There are a few options for servo motors:
- 1. EMAX ES9051 Mini 2.5G Digital Servo (more expensive than option 2, but has less weight and works at higher voltages)
- 2. EMAX ES9051 Mini 4.1G Digital Servo (cheapest option)
- 3. EMAX ES08MD Mini Digital Servo Motor (You will have to do some soldering with this option)
- Both options 1 and 2 include choice for JST connectors that will plug into the Servo TinyShield without need for soldering
A phone application that can interface with bluetooth objects:
- Make sure the battery is connected and charged for the servo motor to work
- You are sending commands to the correct servo (1, 2, 3, or 4)
- The processor board is switched to 'ON'
- The Correct servo address is selected in the program, the default is zero (It will change if you remove some of the resistors on the board, checkout the end of the Servo Tutorial if you'd like more information.)
Attach the TinyZero board, Servo TinyShield, and BLE TinyShield together using the 32 pin connectors. Plug in the battery to the Servo TinyShield.
When it comes to plugging in the servo motor to the Servo TinyShield, you may need to do some soldering. ***Black/brown Ground wire goes to negative(-) labeled symbol, red Voltage wire goes to positive(+) symbol, and the yellow Signal wire goes to the sinusoidal(~) symbol on the board.
***These are the colors for the servos we offer. Most servos will stick to a color scheme like this, but you should always double check the documents of the hardware you're using.
Be sure you have the above mentioned libraries downloaded. Then, here is the zip file for the actual program.
With the program open in the Arduino IDE, you should be able to make your Tools selections to connect to the TinyZero:
Something you may need to note, depending on your computer, is the delay in the setup() loop between the BLEsetup() and servo.begin() function calls. If you get an error in the Serial Monitor that says "Motor driver not detected!" you may need to increase the delay. You may also have a computer where you do not need the delay at all.
Once everything is assembled and software is properly downloaded, you can plug in your Micro USB cable from your computer to your TinyZero. As the program uploads, you should open your Serial Monitor and see:
Now that the BLE TinyShield is discoverable, you should be able to see it on your app. Open nRF Connect:
Your device should have the name BlueNRG, click CONNECT:
You should see a new line on the Serial Monitor that looks like "Connected to device:XX-XX-XX-XX-XX-XX". Now you can send commands to the servo with the app by selecting the UART Service, and then selecting the up arrow symbol on the Nordic UART RX option:
With the text box open, you can now send commands with the app to move the servos. You can send between 800-2200 to the servo:
You should be able to see what commands you've sent by looking at the servo motor itself and the Serial Monitor:
Now you can build a project with the use of these basics and commandable servo(s) at your fingertips!!
As always, if you have any questions or feedback, feel free to email us at firstname.lastname@example.org.
Thanks for making with us!