1 of 31

SPACE CADETS

Robot Arm

2 of 31

ELECTRONICS �&�CODING

3 of 31

This motor controller can drive 16 servos!

4 of 31

This is the brain - we will use it to control the motor driver and other interfaces.

Connect the brain to laptop for power - you should see the red LED turn on.

Reset Button

5 of 31

Concept

Model

6 of 31

First let’s make sure we can control the brain…

http://a9i.sg/ioty ��This is the coding environment

7 of 31

FLASHING

8 of 31

9 of 31

FLASHING - Setup Brain for IoTy

10 of 31

Click on either Connect buttons and find an active, connected COM Port

If you don’t see a COM port in the window, check your brain is connected via USB and call the teacher!

11 of 31

1.

2.

12 of 31

Enter “ioty- <Student #>” assigned by coach

Before you press Flash, reset IoTy once - �click on left/EN/Reset button on Brain

13 of 31

Each time you reset after you successfully flash, you should see Blue LED flash 3 times.

Then will start to blink…

Reset Button

CONNECT TO PC

14 of 31

BASIC CODING

15 of 31

Press the 3 vertical dots, and choose “Connection Mode”. Inside, pick Serial.

16 of 31

Press the 3 vertical dots, and choose “Connect (Serial)”. Choose COM port of brain.

17 of 31

Let’s see if we are connected�Switch to Monitor tab, and reset Brain

18 of 31

You should see this. Almost…

19 of 31

In a bit we will type some python instructions.

First, let’s write the block code to get an idea…

Pin 2 - controls Blue LED

1 means ON

0 means OFF

20 of 31

Download to Device…

Reset Device…

21 of 31

Now paste the last line and hit ENTER -

This should turn on Pin 2 on the brain.

You should see the blue LED turn on!

Can you figure out what to type to turn it off?

22 of 31

MOTOR CONTROLLER

23 of 31

24 of 31

Brain

Motor Controller

3V3

VCC

VIN

V+

GND

GND

D18

SCL

D19

SDA

CONNECTIONS

25 of 31

Now let’s write the code that sets up the motor controller system.

26 of 31

Now let’s write the code that sets up the motor controller system.

27 of 31

Blocks from I2C and PCA-9685 block tabs

28 of 31

Blocks from I2C and PCA-9685 block tabs

29 of 31

And use these instructions to test Robot Arm:

pca9685_device.servo_deg(Ch, Degrees)

Ch = 0, 2, 4 or 6

Degrees = 0 to 180

Connect each of the 4 servos to a channel:

0(base), 2(left), 4(right), 6(claw)

Make sure not to stress motors to impossible positions!

30 of 31

ROBOT ARM�CHALLENGES

31 of 31

How hard is it to use coding instructions to:

  • Move Arm from Side to Side 10 times

  • Move Arm to 1 Position, and open claw
  • Move Arm to 2nd Position, and close claw