GEK Wiki / PCU-Getting Started
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!

View
 

PCU-Getting Started

Page history last edited by jay@... 11 years, 3 months ago

Below are simple instructions to program the PCU.

 

Waring: if you have just received the PCU, it will have factory code on it already. If you do not intend to modify the code, please do not reprogram the board. These instructions are intended to be used if you would like to understand how to upload custom code to the board.

If you are only looking to access the serial data from the PCU, please only refer to Process Control Unit (PCU)_rev3.pdf

 

You will Need


Tools:

  • Computer (Mac or PC)
  • USB cable (type A to type B)
  • Power supply (12v DC) 
  • AVR ISP mkII Programmer (optional)

 

Software:

  • Arduino software
  • KS Library Package
  • APL software

 

 

Getting Started


A. Arduino

      Download and install Arduino software (version 0022) from the Arduino webiste (http://www.arduino.cc/en/Main/software). (If you are having trouble communicating with the PCU, you may have to download updated USB software: http://www.ftdichip.com).

 

B. Boot Loader

 (The PCU typically comes with the boot loader already installed, you will skip this step).

     1. Use the USB cable to connect your computer to the AVR ISP mkII programmer. Connect the programmer to the ISPII 6-pin header just above the LCD screen on the PCU board. Make sure to line up the black arrow on the AVR ISP mkII to pin 1 on the ISP header denoted by the small white square on the PCU.

     2. Open the Arduino environment. Since the PCU (all versions) uses an Atmel Mega; ATmega 1280 chip you will need to select the chip in the Arduino software.  In the menu choose Tools/Board/Arduino Mega (ATmega1280).

     3. Load boot loader onto PCU from Arduino by selecting Tools/Burn Bootloader/ w/AVRISP mkII .

 

This enables the PCU (Atmel1280 chip) to communicate with the Arduino software via USB. It stores a little bit of information in the Atmel chip's EEROM so that it will recognize a USB cable on PCU powerup.

After boot-loading, disconnect the AVR Programmer. You will now be able to connect to the PCU and upload software directly to the board with the USB cable. 

C. Libraries 

     1. Download the libraries here: KSlibs - Arduino Support Libraries

     2. Load Libraries onto your computer into the correct folder. (The KSlibs file may have a version number within the file name. Rename the library file "KSlibs").

    • Windows:  Add KSlibs folder to arduino-0022/libraries (earlier versions of arduino handle file hierarchies differently, make sure you have your libraries in the correct folder).
    • Mac:  Documents/Arduino create folder called libraries. Place KSLib into this folder. 

This allows the Arduino access to our libraries and any custom ones if you choose to include them. Without this step the Arduino software will not be able to compile our libraries, or yours, with the sketch when you load a sketch calling for the libraries. Notice now in Arduino software that you can access the KSLib and examples. This is a library folder separate from arduino that you can place other libraries into if you wish. The libraries in this folder will be accessible through the Arduino software menu once arduino restarts. If you update Arduino, these libraries will still be accessed by the program.

 

Libraries are a way in which to simplify code and include functions, or methods, that call be called from a smaller bit of code. This helps with code management and user functionality. Instead of repeating long bits of code many times over, you can make it a library that you call from a simpler statement when you need it in a sketch (program). This makes the code appear more concise and can highlight the important variables that one might want to customize within a sketch.

 

D. Sketchbook

Arduino saves programs as 'sketches' that are located in the 'sketchbook'. 

     1. We have a few programs that we use to run various projects here at ALL Power Labs. You will want to chose the program that will best fit your needs.

a. KS Datalogging2: Data logging code that reads from all sensors and outputs through serial connection.

b. KS Engine3: Code that senses and controls the PowerPallet

c. KS_Testing.zip: testing code (we use this for our internal purposes, however if you would like to build off of this code we provide it here)

d. TempControl: (thermostat control code)

     2. Download code or place your own code into the Arduino folder. 

    • Windows: My Documents/Arduino
    • Mac: User/X/Documents/Arduino

Which sketch to upload? That is your choice. There are many and some are for different purposes. When choosing a sketch, if it has include library statements, be sure to include the libraries as we did in Step C or the sketch will not compile and you will get an error.

 

E. Commuicate with the PCU

     1. Turn the board off by disconnecting the power adapter. Connect the USB cable to the computer and the PCU. 

     2. Turn on the board while checking to see if the USB connection is recognized by your computer. You may check this in the Arduino menu Tools/Serial Port/

     3. If not you may need to install the boot-loader again (Step B).

     4. Select Arduino Mega ATmega1280 from the Arduino menu Tools/Board.

 

F. Upload Code

     1. Chose your code from the Sketchbook through the Arduino menu File/Sketchbook.

     2. Compile the sketch by the Arduino menu Sketch/Verify/Compile (or by clicking the arrow icon in the upper left of the Arduino interface).

     3. If it did not compile, you can troubleshoot your error code via the Arduino online forum here: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl or by contacting us at support@allpowerlabs.org.

After up-loading, the PCU LCD should now read some thing like "KS GCU V 3.0" At ALL Power Labs, we sometimes interchange GCU with PCU. PCU is the correct terminology. However, since we can now program the PCU, changing the sketch to read "KS PCU V 3.0"  is no problem.

 

Comments (1)

jay@... said

at 3:52 pm on Nov 18, 2011

Adapted from Nathaniel's original instructions. Thanks Nathaniel!

You don't have permission to comment on this page.