CIKU is born from the experiences of using Arduino and feedback we gather from SK40C users. Ciku comes with PIC18F4550 pre-programed with Microchip USB HID Bootloader and with this, loading program will only require a USB Mini-B cable, no extra programmer is needed. This will lower the cost needed to get the start. In this tutorial, I will show how to integrate CIKU with Shield 2A motor and Stepper Motor.
- USB Mini Cable (2.0)
- Adapter 12V 2A
- 2 Amp Motor Driver Shield
- Bipolar Stepper Motor or Unipolar Stepper Motor
Please refer to “Getting Started with CIKU” tutorial.
1. Get a CIKU board, 2Amp Motor Driver Shield, Jumper wires and USB cable
You will need a CIKU board, 2Amp Motor Driver, Jumper wires and USB MiniB Cable (2.0) to start.
2. Download the MPLAB X IDE and XC8 compiler
Download the MPLAB X IDE latest version here and XC8 compiler here. After downloaded finish, please proceed with the installation. Install the MPLAB X IDE first followed by XC8 compiler. If you are new to this software, you can refer to Getting Started with MPLAB X IDE tutorial.
3. Download the CIKU library.
CIKU comes with the library where you can easily write a coding like Arduino style. You can get the updated library here. After downloaded finish, extract to your PC and please remember the folder path. You can refer to this link for CIKU library reference.
*Note: You will need to have a Gmail account. To download it you need to add to your Google Drive first, then you can proceed with the download.
4. Power up the CIKU board.
CIKU board will automatically draw power from either USB connection to the computer OR external power supply. To start, just connect your CIKU board to your laptop/computer using USB cable. The PWR LED (green) will turn ON to indicate the board is being powered, also the RUN LED (red) will turn ON to indicate the board is in the user mode.
7. Open CIKU project.
Open MPLAB X IDE. Go to “File – Open Project…”, point to CIKU library that you have downloaded and open CIKU.X. Under Projects tab, you can open User-Template.c (CIKU – Source Files – user – User-Template.c) to see the user code.
8. Build CIKU project.
Every time you edit the code and want to upload the program to CIKU board, you need to build it first. Click on the “Build Project” icon (hammer) and make sure there have no errors. It will display BUILD SUCCESSFUL.
9. Enter the bootloader mode.
Before uploading the program to CIKU board, we need to make sure that the CIKU is in the bootloader mode. To enter the bootloader mode, simply press SW button (and hold), then press the RESET button (and release), then release the SW. The RUN LED (red) will blink to indicate the CIKU board is already entered the bootloader mode.
*You can refer to video.
*Please be remind that the bootloader only can be entered when there has a USB connection between your CIKU board and your PC.
10. Upload the program to CIKU board.
Open HIDBootloader.exe (..\Bootloader Software\win\HIDBootloader.exe). If your CIKU board is in bootloader mode it will display “Device Attached”, but if your CIKU board is in user mode it will display “Device not detected”. So make sure your CIKU board is in bootloader mode. Click on the “Import Firmware Image” icon and open your HEX file (..\CIKU.X\dist\default\production\CIKU.X.production.hex).
11.Then click the “Erase/Program/Verify Device” icon. This state will upload the program to CIKU board.
12.After done uploading, click on the “Reset Device” icon to enter the user mode. Now your LED on CIKU board should blink. Done!
pinMode(LED, OUTPUT); //onboard LED as output
pinMode(SW, INPUT); //onboard SW as input
Shield2AMotor_waveDrive(200, CCW, 10); //360 degree rotation using 1.8° stepper motor
Shield2AMotor_waveDrive(200, CW, 10); //360 degree rotation using 1.8° stepper motor
Shield2AMotor_fullDrive(200, CCW, 10); //360 degree rotation using 1.8° stepper motor
Shield2AMotor_fullDrive(200, CW, 10); //360 degree rotation using 1.8° stepper motor
Shield2AMotor_halfStepDrive(400, CCW, 10); //360 degree rotation using 1.8° stepper motor
Shield2AMotor_halfStepDrive(400, CW, 10); //360 degree rotation using 1.8° stepper motor