Introduction: HelloServo Box - Wifi Connected Motor
For this project we will be building an extremely simple net-connected servo device that you can control with your smart phone.
I wanted to keep the creative potentials open so you can easily apply this to a bunch of different ideas or projects.
In a simple way I will teach you how to make a motorized servo connected to your wifi.
This is an extremely beginner level DIY project and gets into a number of different techniques so I hope you enjoy!
Big special thanks to Colin Parsons for help with this instructable.
Step 1: Find Supplies
We will be using a number of inexpensive components available online. The whole project should cost less then $20 to complete.
- Wemos D1 Mini
- These little things are amazing! They are less expensive than an arduino yet can be programmed almost the same. They have a USB port so you do not need to worry about complicated uploading procedures.
- Micro Servo
- These tiny servos work fine off of the power pins of the D1Mini. A bigger servo may need more power. The 3D printed designs in this tutorial will fit this micro servo.
- Wooden Dowel 6"
- Use any 1/4" dowel you like but make sure not to put too much weight. The micro servos aren't super strong
- Soldering Iron + solder
- You should have one of these by now! Pick up a simple kit off of amazon if not, we will not be doing a lot of soldering in this DIY.
- Amazon This will get you started, but if you are interested in doing electronics, do some research on a more professional model.
- Glue Gun
- We will be using a larger size hot-glue gun for most of the assembly
- Tiny philips-head screwdriver
- The tiny servo has only one screw we need to worry about. If you have a glasses repair kit, that should work well.
- Wire strippers
- The tiny wires on the servo are delicate and you will definitely appreciate a wire stripper
- Micro USB Cable
- often the same as android charger cables
- here is one on Amazon
Step 2: Drivers Plugging Uploading
Next up we will be uploading code onto our WeMos and testing our sevo.
First you will need to get your WeMos drivers installed onto your computer.
Make sure you have the newest version of Arduino IDE.
Next, get the USB driver for the chipset
Wemos has a great guide at getting up and running quickly:
When you are all up and running, you should be able to try some of the simple example codes uploading directly to your device.
Now we can dive in. Go to the GitHub repo and download the latest code.
- Open up the HelloServo.ino file into the Arduino IDE.
- You will need to change these lines of code in order to get it to work.
- Type in your wifi name and it's password before uploading.
- You can pick any device name you like, or leave it for now.
const char* ssid = "YOUR WIFI"; // change this to the name of your wifi const char* password = "YOUR PASSWORD"; // change this to the password of your wifi const char* deviceName = "helloservo"; // pick a name that you can use to find this on the network</p>
2. Once you have uploaded, open the serial monitor and view at 115200 baud
- you should see an output in the serial monitor window that shows it has connected to your Wifi and has an IP address.
- At this point you can go to your web browser and type in the URL bar "http://helloservo.local" or whatever you picked in your code.
- Alternatively, some devices need to use the IP address directly, type the one you see in the serial monitor after "http://"
- Load the page and you should see a big slider! Try moving it and look for outputs in your serial monitor.
Step 3: Connecting the Servo
We only have three connections we need to make from the servo to the WeMos.
The Servo has three little wires that come out of it. They are pretty fragile but if you are careful it is a simple soldering job.
- The Brown one is known as Ground and it will connect to the 'G' pin on the WeMos
- The Red one is our Positive line, we can connect that to the '3v3' pin on the WeMos
- The orange wire is the Signal wire. This wire relays the value we want to set. We can decide where to place it on any 'D#' pin. I have picked pin 'D3' for this tutorial
I am not going to go in depth into a soldering lesson, if you are brand new, check out this great instructable for a primer. I will speed through what I do just in case you want to follow along. I have included a bunch of photos a videos of my process.
- Cut and strip the servo wires
- twist the strands so that they do not fray and become annoying
- thread the wire into the three connection points on the WeMos and solder the wires
DONE! Lets test!
Plug in the WeMos to a usb cable and go back to that URL. If you didn't change the device name it should work at http://helloservo.local/
Move the slider and see it move!!
Note: You do not need to have it plugged into your computer or the Arduino windows open anymore. You can now connect it directly to any charger or battery or computer to power the WeMos.
Step 4: 3D Printing, Modeling, Assembling
Here we will shift gears again and start doing some 3d modeling.
I want to build a simple plastic enclosure that can hold all the parts snugly and hide the electronics.
I have designed three 3d printed parts using solidworks, but you can use just about any modeling software.
More about 3D printing at this Instructable
And more about Autodesk modeling classes here
Make the Base
- First step is to model all of the components we are going to use. In this project only the Servo parts and WeMos are modeled in the computer.
- Use a calipers to start defining the shapes of the object.
- Move around the object adding simple shapes as it starts to take form.
- Don't forget to leave room for cables and wires coming out. I often forget to leave room and need to re-print!
- For this project we are going to build a simple base that we can glue the components onto.
- In order to get everything aligned correctly, we are using the solidworks Cavity function to cut out the servo shape from the base shape
- make sure to add a bit of scaling onto the cavity so that the servo will fit snugly without having to sand away plastic.
- This is done by creating form around the server where we want it covered and applying the cavity of the severo shape onto the base part.
- Next it would be nice to make a little spot that can hold the WeMos. Make a little ridge with a gap for the USB cable.
- Lastly we model the Servo rotation handle so that we can make sure nothing will collide when it rotates.
Make The Mount
This part is when it starts to get fun, You can attach anything you like onto the servo. I find it pretty challenging to 3d print parts directly for these tiny servo ends. Instead I build a little adapter that can glue onto the holder for the servo.
In this instructable I have included a STL for the 1/4" dowel holder but you can design as you like. I will include some alternative designs soon.
Make The Top
I built the top out of a very simple boxy shape to hide all of the interior components and still allow the arm to swing. You can make some other fun designs as you feel like it and swap out the base with a new top.
I used Sli3er to cut it up and put it onto my Prusa i3 printer with PLA filament. You shouldn't need any support material when you print them
Lastly we want to put all of the things together.
Make sure to center the round opening to the center of the servo arm. You will screw into the servo after it's glued. Feel free to use your glue of choice. Superglue may have been a wiser option for longevity.
Use the Philips head screwdriver to carefully tighten the screw into the servo. Hold the mount so it doesn't break the plastic.
Step 5: Decorate and Expand + Files
Now you can get started making fun things for your new creation.
Be creative, make flags out of paper, make an origami folding fan, or maybe you want an analog value gauge. The choice is yours!
I have included here all of the files and code that are in the github repo.
For the most up to date stuff stick with the repo instead.
Here is another link
Excited to see what you come up with! Take it to the next level!
Those who were looking carefully noticed that the arduino has an endpoint specifically for setting its value!
This means it is extremely easy to connect to other IOT things.
just go to http://helloservo.local/set?val=10 and change the last value to anything between 0-180 degrees.
Now you can program other things to talk to this servo also.
We have a be nice policy.
Please be positive and constructive.