Monday, October 2, 2017

How to make a Spinning LED using a Servo, coded with S4A and Controlled via Arrow Keys

How to make a Spinning LED using a Servo, coded with S4A and Controlled via Arrow Keys By: George

  1. You will need the following parts:
  • Arduino Uno
  • USB cord
  • Computer with S4A downloaded, Arduino the app download, and internet access
  • Normal servo with a disk on the top (not one with an arm-like thing on top, it needs a disk)
  • Three male-male wires corresponding with the color of the three wires attached to the servo
  • One LED of any color
  • Two male-female wires (the wires I used in this demonstration are red and blue, but you can use any color if you know where to connect them to the Arduino)
  1. Go to the link shown in the picture.

  1. Copy the code by highlighting it and then using the keys Ctrl and C at the same time.

  1. Open the Arduino app on your computer and delete all the normal Arduino code there.
  2. Paste the S4A code into the blank Arduino app using the keys Ctrl and V at the same time
  1. Connect the Arduino board to the computer with the USB cord.
  1. Go to the tools area of the toolbar, hover over the port option, and change the port to the one that says “Arduino/Genuino Uno”.

  1. Upload the S4A code to the Arduino board.

  1. Open S4A and create the code shown in picture.

  1. Connect the servo’s colored wires to the corresponding color male-male wires you have (the brown wire attached to the servo I’m using is supposed to correspond to my gray male-male wire).

  1. Attach the red or orange wire to the 5 volt pin, the brown or black wire (gray in my case) to a ground pin, and the yellow or white wire to the digital 8 pin.

  1. Stick the LED wires through two close together holes on the spinning disk of the servo.
  2. Attach a male-female wire to both of the LED wires, on the bottom of the spinning disk.

  1. The wire that has its female end connected to the longer leg of the LED (the ground/negative leg) has its male end in a ground pin, and the wire that has its female end connected to the shorter leg of the LED (the positive leg) has its male end in the 3.3 volt pin.

  1. The LED should then power on.

  1. Use the right and left arrow keys to spin the disk in two different directions, which makes the LED spin. Press the 1 key to stop the motor.
  2. Remember not to let the servo spin too far in one direction or the wires will get pulled tight around the shaft of the servo and pull off the LED.
  3. Have fun building off this little project!

Thank you, George, for sharing with us! -JB

No comments:

Post a Comment