Brandon Roots
  • INTERACTIVE
  • FILM
  • ABOUT
  • CONTACT
September 29, 2020

Lab: Servo Motor Control with an Arduino

broots ITP, Physical Computing

For this lab I set out to control a servo motor based on input from a force sensing resistor. Going into this I had some concerns about the ability of the Nano 33 IoT to supply the necessary voltage and current to power the FS5106B servo motor I had access to.

#include "Servo.h"      // include the servo library
 
Servo servoMotor;       // creates an instance of the servo object to control a servo
int servoPin = 3;       // Control pin for servo motor
 
void setup() {
  Serial.begin(9600);       // initialize serial communications
  servoMotor.attach(servoPin);  // attaches the servo on pin 3 to the servo object
} 
 
void loop()
{
  int analogValue = analogRead(A0); // read the analog input
  Serial.println(analogValue);      // print it
 
  // if your sensor's range is less than 0 to 1023, you'll need to
  // modify the map() function to use the values you discovered:
  int servoAngle = map(analogValue, 0, 1023, 0, 179);
 
  // move the servo using the angle from the sensor:
  servoMotor.write(servoAngle);

  //delay(200);
}

Initially powering the servo from the Nano’s 3 volt rail resulted in no movement. This made sense considering the data sheet for the FS5106B servo specifies a minimum voltage of 4.8 volts. USB supplies 5 volts so shouldn’t I have access to that somewhere on the Nano 33? Reading on the Arduino site I learned I had to short the VBUS jumper on the back of the board to provide 5 volt power to the VUSB pin. After doing this moving the servo supply to the Nano’s VUSB pin did power up the servo and allow the force sensor readings to control it, however after a few seconds of movement a yellow light on the nano began to flash and motor movement stopped. Was the servo drawing too much current?

Looking back at the data sheet for the FS5106B servo the current at no load should be about 160mA. This is both less than the USB expected max load of 500mA and more than the DC Current per I/O Pin of 7mA listed on the Arduino site.

Another explanation may have to do with the Nano 33 IO pins not being 5 volt tolerant. Are the data and power lines on the servo separate? This is unclear to me. To avoid any potential damage to the board I will stop here for now.

Lab: Tone Output Using An Arduino Project 1: Dodeca – Part 1

Related Posts

Fractal Plant – Foiled by  Registers

Homemade Hardware, ITP, Solar Plant

Fractal Plant – Foiled by Registers

Since receiving the PCBs and successfully soldering the board together I have been trying to rewrite code for the I2C port expander. This has been immensely difficult! The Inkplate Arduino Library makes considerable use of an “Mcp” class, which is written to work with the MCP23017 GPIO expander IC. These chips are quite difficult to […]

“Handling” Playtest Week

Handling, ITP

“Handling” Playtest Week

Last week we attended “Playtest Thursday” on the second floor of 370 Jay St with our games. I came away from the experience with some very specific feedback. Seeing a number of people play the game showed me things I didn’t anticipate. Some folks approached the cabinet and immediately treated it as a touch screen. […]

Fractal Plant – Beta Build

Homemade Hardware, ITP, Solar Plant

Fractal Plant – Beta Build

The boards arrived! Amazingly within an hour of one another. Based on the experience I think that JLCPCB is a better value. With shipping OSHPark was $55.50 for 3 boards. JLCPCB was $26.36 for 10 boards. Aside from a higher cost OSHPark also left sharp bits of tabs around the edges of the boards which […]

Recent Posts

  • Fractal Plant – Foiled by  RegistersFractal Plant – Foiled by Registers
    May 9, 2022
  • “Handling” Playtest Week“Handling” Playtest Week
    May 5, 2022
  • Fractal Plant – Beta BuildFractal Plant – Beta Build
    April 24, 2022
Brandon Roots