Introduction: Controlling a Robotic Arm Using the Creator Ci40

Creator Ci40 is the new IoT platform developed by Imagination Technologies for a successful Kickstarter campaign. Ci40 uses a dual core 550Mhz MIPS processor, 2 Gb of RAM and runs OpenWRT as the operating system. In terms of connectivity the board provides: WiFi, Ethernet, Bluetooth and 6LoWPAN. In this project, we will toggle the board's LEDs on and off with the switches on the board using the wrappers for LEDs and switches in the LetMeCreate library.

Step 1: Requirements

Creator Ci40

MeArm Robotic Arm

MikroElektronika Joystick Click

Adafruit 16 Channel 12 Bit PWM Driver

Ubuntu 14.04 (either a full installation or running on a virtual machine)

MicroUSB to USB cable

Ethernet Cable

USB drive

Step 2: Setting Up the Board

The first step is to connect the Creator Ci40 to a power source, a computer over USB, a USB drive containing openwrt from which to boot and the network via ethernet. To connect to the board over serial:

  • $ ls /dev/ttyU*
  • /dev/ttyUSB[x] will appear if the device is plugged in
  • sudo miniterm.py /dev/ttyUSB [x] -b 115200
  • Press enter
  • # run usbboot
  • openwrt will now boot. After new timestamps stop appearing, press enter. The openwrt logo should be displayed, along with a terminal to issue commands on the Creator Ci40

If there are any problems booting, first try pressing the reset button on the board. You will then need to press any key to prevent autoboot before the run usbboot command.

Step 3: Compiling the Code

The next step is to compile the code:

  • Follow the instructions found in the LetMeCreate Readme to integrate the library with openwrt
  • To transfer the files to a USB:
  • df
  • The USB appears as /dev/sdbx. If necessary, unplug the USB and run df again to see which device disappears
  • umount /dev/sdb[x]
  • sudo mkfs.ext4 /dev/sdb[x] This formats the USB as ext4 format, which is used by the CreatorBoard. Check the USB is empty. If not, re-enter these commands
  • sudo nautilus
  • This opens a root file explorer. Copy the contents of /path/to/openwrt/bin/pistachio/openwrt-pistachio-marduk-marduk-cc2520-rootfs to the root folder of the USB
  • sync
  • Now, download the files in the servo_control repository:
  • $ git clone https://github.com/MatthewRFennell/servo_control.git
  • (Note: alternatively, you may download the zip file)
  • Follow the instructions found in the Readme to move the server files to the correct location, update the make list and compile the code.

Now you must copy the compiled program to the Creator Ci40 - this is done using scp to copy the files over the network:

  • On the board, run ifconfigto get the IP address to transfer the files to
  • Now, on the computer:
  • scp /path/to/openwrt/bin/pistachio/packages/custom/letmecreate_0.1_pistachio.ipk root@IP ADDRESS:~/
  • (Note: change the IP address and path to the openwrt folder as required)
  • If required, type yes to transfer the files to the board

Now that the updated LetMeCreate package is on the board, it needs to be installed:

  • opkg install ~/letmecreate_0.1_pistachio.ipk
  • The robot arm program should now be found in /usr/bin/letmecreate_examples/

Step 4: Controlling the Robot Arm With the Joystick Click on the Board

Now the code is installed on the board, the next step is to connect the shield to the board to allow for communication between the Creator Ci40 and the servos. Writing to the servos is done using the i2c protocol, and the Raspberry Pi interface on the Creator Ci40 is used for communication between the shield and board. 4 pins are required for communication between the shield and the board:

  • A 3V supply to allow for communication between the board and servos: Pin 1 -> VCC
  • I2c data transmission: Pin 3 -> SDA
  • I2c clock: Pin 5 -> SCL
  • Ground: Pin 6 -> GND

This information is also found on page 18 of the Creator Ci40 hardware guide.

The next step is to supply power to the servos:

  • Pin 2 -> V+
  • Pin 9 -> GND

(Note that these V+ and GND pins are on the long side of the shield, not the left or right edge.)

Now you can attach the servos themselves to the board as shown. This is done with the brown wire closest to the edge of the board.

  • Left/Right -> Pin 0
  • Forward/Backward -> Pin 4
  • Claw -> Pin 12

Also connect the joystick click to the second MIKROBUS port on the Creator Ci40 (the Raspberry Pi interface to control the robotic arm is written through the first port)

Now you are ready to run the program. On the Creator Ci40:

# /usr/bin/letmecreate_examples/letmecreate_test_robot_arm

Moving the joystick will move the robotic arm. Pressing the buttons on the board will open and close the claw.

Step 5: Running the Robot Arm Using the Joystick Click With a Clicker

Compiling, transferring and running the server code is much the same as the local code in section 1, and details can also be found in the servo_control repository.

Now you must copy the compiled program to the Creator Ci40 - this is done using scp to copy the files over the network:

  • On the board, run ifconfig to get the IP address to transfer the files to.
  • Now, on the computer:
  • scp /path/to/openwrt/bin/pistachio/packages/custom/letmecreate_0.1_pistachio.ipk root@IP ADDRESS:~/
  • (Note: change the IP address and path to the openwrt folder as required)
  • If required, type yes to transfer the files to the board.

Now that the updated LetMeCreate package is on the board, it needs to be installed:

  • opkg install ~/letmecreate_0.1_pistachio.ipk
  • The robot_arm_server program should now be found in /usr/bin/letmecreate_examples/

Note: running the server program at this point will do nothing.

Now that the server code is up and running, the next step is to compile the client code:

Now you can compile the client code and run it on the clicker:

  • LetMeCreateIOT/examples/robot_arm$ make
  • Plug the PICkit 3 Microchip into the USB port of the computer, and connect the PICkit 3 Microchip to the clicker using the pins on the side with the label “PICkit”. Ensure that the arrow in the PICkit is lined up to the “RST”
  • Select the device model (eg PIC32MX470F512H) and press Apply. The Tool box should now fill
  • Now click Connect to connect to the clicker
  • Now browse to the correct folder with the source code in it (LetMeCreateIOT/examples/robot_arm_client). Select the main.hex file
  • In Settings, enable advanced mode. In the Power tab, enable “Power Circuit from Tool”
  • Click Program

Now run the server program on the Creator Ci40:

  • /usr/bin/letmecreate_examples# ./letmecreate_test_robot_arm_server
  • Moving the joystick will move the robot arm, and pressing the left hand button will toggle the claw being open and closed.

Step 6: Running a Robot Arm With a Webapp

Install git and node.js on the board:

  • # Opkg install git
  • # Opkg install node
  • # Opkg install gcc

Clone the repository somewhere on the board:

Run ifconfig to find the IP address of the board

  • servo_control/webapp# npm start

Now, with another device on the same network, open a web browser to access the webpage:

http://[Ci40 IP Address]:3000

Comments

About This Instructable

196views

3favorites

License:

Bio: Creator Ci40 is and IoT development kit. Based on MIPS architecture Ci40 provides all the tools to quickly develop and deploy any IoT project.
More by creatordev:Controlling a Robotic Arm Using the Creator Ci40Creator Ci40 LED SwitchCi40 Relay Webapp
Add instructable to: