Control two servos on a single Grove port.
Keyword Search: Servo, Unit, Loop, Wait, Grove, 180, GroveT, Grove2Servo, Core, 180,
IntroductionIn the previous project I showed you a simple single servo project. In this example, I will show you how to use two servo's on one port.
AimThe aim of this project is to show you how to use two servos on one port by modifying a servo adapter to use a different data line.
Apparatus- M5Stack Core,
- An M5Stack 180 degree servo,
- Grove Cable,
- Grove T
- Grove 2 Servo adapter,
- Internet enabled computer,
- Soldering Iron,
- Wire,
- Screwdriver.
- Multimeter
In order to connect a second servo to a port with a servo already connected we need to make an adapter. In a previous guide I showed how to modify the cable as that was the easiest method. The Issue with that method is that you would need to remember that the cable is modified and so using it without checking will lead to issues with projects failing. In this project I will show you how to modify the Grove2Servo adapter for a more compact, neater look.
By default the Grove2Servo connector is wired as shown in the image on the left. We need to cut the copper tracks on both sides of the PCB in order to connect the servo signal or orange wire, to a different pin on the grove side.
In the first image I used a flat blade screwdriver to carefully remove the solder mask revealing the copper track that need to be cut. In the second image I have removed the copper between the pins. This need to be done on both sides of the adapter.
Next take a small piece of wire (I used the offset leg from an electronic component), and carefully solder the wire so that it only links the pins shown in the next image.
Once finished soldering, use the multimeter to test the pins to make sure that the soldered joint is correct.
Next we connect two grove cables to a GroveT and connect the Grove2Servo adapters to the ends of the cables and the servo's to the adapters.
To control the two servo's we start with the code from the servo test and modify it in order to use the two servos. First we disconnect the single servo from port A and plug in the GroveT into port A.
Open UIFlow and add an Angle unit to port B however, to add the servo's we need to use the Custom port.
Add two servos but set one to SDA/TX22 and the other to SDA/TX21
Next copy this program.
If you rotate the angle sensor to a position and then press button A or B one of the two servo's will move to that position and stay. To change the position or move the servo back to 0, you need to rotate the angle sensor back to the start and then press button A and B again.
ConclusionLike the previous servo tester, there is much room for improvement. Again this is just a basic example and doesn't exactly work how I imagined however, it does provide the functions and controls needed to use two servos on only one grove port.
Comments