Introduction: Creator Ci40 LED Switch

About: Creator Ci40 is and IoT development kit. Based on MIPS architecture Ci40 provides all the tools to quickly develop and deploy any IoT project.

Creator Ci40 is the new IoT plaform 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 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

  1. Creator Ci40
  2. Ubuntu 14.04 (either a full installation or running on a virtual machine)
  3. MicroUSB to USB cable
  4. Ethernet Cable
  5. USB drive

Step 2: Setting Up the Board

Initial setup:

    1. Connect the board to a power source as shown
    2. Connect the board to the network using the Ethernet cable as shown
    3. Connect the board to your computer using the USB to micro USB cable as shown
    4. Install the openwrt packages and LetMeCreate library by following these steps
    5. Then, to transfer openwrt to your USB:
    6. Plug the USB into the computer.

    7. $ df

    8. The USB appears as /dev/sdb[x]. If necessary, unplug the USB and run df again to see which device disappears

    9. $ umount /dev/sdb[x] (replace x with the number given by the df command)

    10. $ sudo mkfs.ext4 /dev/sdb[x]

    11. This formats the USB as ext4 format, which is used by the CreatorBoard. Check the USB is empty. If not, re-enter these commands.

    12. $ sudo nautilus

    13. 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

    14. $ sync

    15. Connect the USB drive containing openwrt to the board using the USB to micro USB cable as shown

    Step 3: ​Establishing a Serial Connection

    1. To establish a serial connection with the board, open a terminal:
    2. $ ls /dev/ttyU*
    3. Will list all of the serial devices connected to the computer. If there are multiple serial devices found by this command, unplug the Ci40 and run the command again to see which has disappeared - this is the board.
    4. $ sudo miniterm.py /dev/ttyUSB1 -b 115200
    5. Will establish a serial connection with the board (where you replace /dev/ttyUSB1 with the result of the previous command)
    6. When a connection has been established, press enter. Then,
    7. # run usbboot
    8. openwrt should now boot. If the error "ERROR: can't get kernel image!" appears, unplug the USB containing openwrt and plug it in again. Alternatively, press the reset button on the edge of the board. Then, press any key to prevent autoboot and attempt the previous step again
    9. Now openwrt will boot. Once the timestamps have stopped appearing (usually around 35 seconds), press enter to activate the console

    Step 4: Downloading the Code

      1. To install git on the computer:
      2. $ sudo apt-get install git
      3. Now, clone into the project:
      4. $ git clone https://github.com/MatthewRFennell/ci40_led_switc...
      5. Follow the steps on GitHub regarding the CMakeLists.txt file

      Step 5: Compiling the Code

        1. On the computer, transfer test_led_switch.c to custom/letmecreate/LetMeCreate/tests/
        2. Now recompile the LeMeCreate library:
        3. openwrt$ make package/letmecreate/compile V=s
        4. Now you can copy this over to the board over the network using scp. Ensure the board is connected to the network via the ethernet cable. Then, on the board:
        5. # ifconfig
        6. This will show the inet address of the board in the eth0 section. This will change every time the board is reconnected to the network. Copy this address. Now, on the computer,
        7. openwrt $ scp /path/to/openwrt/bin/pistachio/packages/custom/letmecreate_0.1_pistachio.ipk root@PASTE THE IP ADDRESS HERE:~/
        8. Replace the path to the letmecreate_0.1_pistachio.ipk package and the IP address of the board as required. If prompted, type yes to transfer the files.
        9. To ensure the file has been copied over to the board, on the board:
        10. # ls ~/
        11. If the package appears: # opkg install ~/letmecreate_0.1_pistachio.ipk

        Step 6: Running the Program

        • On the board, run
        • # /usr/bin/letmecreate_tests/test_led_switch
        • Whilst the program is running, clicking the outermost switch on the board will toggle all of the LEDs on the board. Pressing the innermost switch will end the program.