Have you ever wondered how does Arduino Joystick Servo Control based robot arm works? Or even wanted to make an automated door locker? Or watched a robot that sees all its surroundings with only one sensor, and wanted to make your own?
Then you have to know that all these things use servo motors to enable the device to rotate a specific part of it (ex: robot arm) at a certain degree .. this is simply the magic of servo motor “the ease of controllability”.
So, we’ll give it a try here with taking servo control to a whole new level by using 1Sheeld to make Arduino Joystick Servo Control tutorial.
The idea behind Arduino Joystick Servo Control is to control the servo wirelessly via 1Sheeld board that communicates with 1Sheeld Joystick shield App. So, we will use a 180-degree servo motor where we’re going to control only 3 positions:
0 degree (which is the direction to the most right).
90 degree (which is the direction to the most up).
180 degree (which is the direction to the most left).
Firstly, if this is your first time to deal with 1Sheeld or you want to learn more about it, then I recommend checking this quick and easy getting started tutorial.
And if you haven’t played with a servo motor before, I recommend checking this quick video.
Now, after you’ve become a little bit familiar with 1Sheeld, let’s start!
Step 1: Hardware components:
– Arduino Uno.
– 1Sheeld board.
– S90 servo motor.
– 3 * Male to male wires.
– Arduino USB cable or 9-12v battery.
– Android/iOS phone with 1Sheeld App installed on it.
Then connect the servo motor 3 wires as illustrated below:
Switch the 1Sheeld power to operate on 5v (Not the 3.3v):
1Sheeld have 2 modes: Uploading mode and Operating mode. You can switch between them using the switch close to the Digital pins and is called “UART SWITCH” on 1Sheeld and “SERIAL SWITCH” on 1Sheeld+.
Firstly, you slide the switch towards the “SWITCH” notation which turns the 1Sheeld board into the Uploading mode to let you upload the Arduino code.
Secondly, after you finish uploading the code, slide the switch towards the “UART” notation (or “SERIAL” at 1Sheeld+ board) which turns the 1Sheeld board into the Operating mode to communicate with your smartphone 1Sheeld App.
Connect the Arduino via your PC using Arduino USB cable.
Step 4: Code:
I would recommend checking the Arduino Joystick Shield documentation to know more about the Arduino Joystick Shield functionalities and how to use them.
Now, switch the 1Sheeld board to the Uploading mode then upload this code:
Arduino Joystick Servo Control Project
This example shows an application on 1Sheeld's gamepad shield.
By using this example, you can control a servo motor using Joystick from 1Sheeld.
You can move the servo up, right and left using the shield direction buttons.
To reduce the library compiled size and limit its memory usage, you
can specify which shields you want to include in your sketch by
defining CUSTOM_SETTINGS and the shields respective INCLUDE_ define.
/* include 1Sheeld library */
/* include Servo library */
/* define servo pin */
/* make a servo object */
/* start communication with 1shield */
/* attach servo pin */
/* initially move servo angel to position 0 degree */
/* move servo angel to the most up when up button is pressed */
/* move servo angel to the most right when right button is pressed */
/* move servo angel to the most left when left button is pressed */
/* Do nothing */
Then, Switch the 1Sheeld board to the Operating mode then open the 1Sheeld app and connect it to the 1Sheeld board via Bluetooth.
Step 5: Run the Arduino Joystick Servo Control:
Switch the 1Sheeld board to the Operating mode then open the 1Sheeld app and connect it to the 1Sheeld board via Bluetooth.
Finally, select the Gamepad shield from the shields list.
Now, you are ready to start playing with your servo at the 3 directions; right, up and left by using your smartphone .. have fun with it ^_^
Hope you enjoy this Arduino Joystick Servo Control project! .. Follow us for more tutorials using 1Sheeld.
Arduino Security Camera Have you ever wanted to check your home in real time? Afraid that maybe someone has stormed in, don’t remember if you shut the door or not or maybe wanna check if your Hyper-energetic dog has broken any of your dishes AGAIN!! 🙂 Then this is the perfect place for you cause today …
Arduino makers …. you can connect your Arduino to MQTT brokers(servers) and launch your IoT with Arduino IoT Shield! It’s the 1Sheeld IoT shield that will do the job for you. It’s one of the most important but recent Arduino shields in 1Sheeld. Simply, it turns your Arduino into MQTT client where you can publish and …
Monitor my home environmental parameters remotely is one of the most desirable things I have ever wanted to make. It’s not about purchasing such a system that can get the job done for me. But, passion to create it myself. So, today, I am going to connect the popular DHT sensor to an online MQTT …
“Oh God! … It seems like I have forgotten the door lock open, again” … the normal saying whenever I am in hurry to go out! Have you encountered this problem before? It always confuses me since I may even think that I have left the door lock opened, and once I go back, …
Here I am with another IoT-based home automation project; Arduino IoT Fan Control. Every day, I get back from work tired and feeling hot. No air conditioner here and the fan takes much time to start cooling the room, sadly! So, I was thinking why not controlling the fan from outside my home with my …
Have you ever forgotten to turn your home lights off when you got outside? Sadly, it happens to me all the time. And this causes confusion once I get my bills! Furthermore, here is one secret about me; I am a lazy man. I always want to control my room lamp from my sweet bed. …