Inside the ChapR is an Arduino. Specifically, it has a 5v pro-mini from SparkFun with an ATmega328 running at 16MHz. And you can program it yourself! We put a programming header on the pro-mini so you can easily attach a programmer and download your own code, or one of the many updates we will release for the ChapR. If you’re looking for the latest software update, look here.This page includes everything (OK, not EVERYTHING) you need to know to program the ChapR. It’s a rather long page, so feel free to scroll down to the section you want. Here’s a list of the sections, and what you can find in them:
- ChapR Programming Set-up – how to connect the programmer to the ChapR
- Arduino IDE Setup– how to setup the Arduino IDE so it can communicate with the ChapR.
- Important Programming Tips – there are a few things you should know about programming the ChapR.
ChapR Programming Set-Up
You can program the ChapR yourself! And you can also set configuration settings like a programmer. Here is a quick tutorial about how to set-up the ChapR to be programmed, or configured using the Arduino IDE or a Serial Port.
Get the ChapR programmer. It is actually an Arduino programmer that we got from SparkFun. Click on the picture on the right to be taken to the Sparkfun site where you can buy it. Note that you need to get the 5v version.
Then find a USB to micro-USB cable (fairly standard, but it did NOT come with the ChapR). You are on your own to find one. Simply plug the USB side into your computer and the micro-USB side into the programmer.
Then, you have to OPEN UP THE CHAPR! No big deal. There are four screws on the bottom of the ChapR that you remove to get to its innards. All of the ChapR lights and buttons are connected to the board so the top cover comes off easily.
|Your target is the “Programmer Connector” that is on the right side of the ChapR’s Arduino as shown in the picture below. It is a six-pin connector that is leaned a bit to the right. You will need to move the battery box in order to get the programmer connected to it.|
IMPORTANT – the programmer must be placed on the connector in the right way. There are markings on the programmer that say GRN and BLK. There are the same markings on the Arduino. Line them up!
Arduino IDE Setup
- First, open the zipped folder of source code and extract the files into a place of your choice. Then open the ChapR.ino file.
- Next, we need to change some settings on the IDE so that the computer can communicate properly with the ChapR. First, we want to change the board under Tools> Board to “Arduino Pro or Pro Mini”. Then, we want to change the port to COM4 (below). Now we are ready to transfer the new files.
- Now that we are ready to send the code over, click the upload button and wait until it finishes and displays the message shown below. Make sure your ChapR is on as it will go to sleep automatically with inactivity.
- Lastly, we need to make sure that the upload has completed successfully. Open up the serial monitor (1st below) and change the baud, or frequency, to 38400 so the message “ChapR 2.1 up!” is displayed (2nd below).
After downloading both the Arduino IDE and v2.0 code from here, it’s time to setup and download.
You’re done! Congrats! Click here to set-up the Linux Daemon if you are using an FRC ChapR and haven’t set up your roboRIO already.
Important Programming Tips
When you connect the ChapR to your computer through the programmer, it gets its power from the computer, not from the battery. In fact, the whole battery power circuit is by-passed. So this means a few important things:
- You should remove the battery when programming the ChapR
- If you leave the ChapR plugged into the programmer for a while, the ChapR may hit its “auto turn-off time” and try to turn itself off. Since the programmer by-passes the battery power circuit, the ChapR won’t be able to turn itself off and it will start issuing its power-down sound continuously and angrily. Don’t worry, just press the reset button on the Arduino to silence the ChapR.
- When the ChapR tries to power down, it tells both the VDIP and Bluetooth module to go into low-power sleep mode. Sometimes these modules won’t wake-up from this mode until ALL POWER is removed. So for a complete reset, remove the programmer from the ChapR, then put it back on.