Compile Firmware in Arduino IDE

First you will need to install the Arduino IDE on your computer, you can download it from here.

Next download the OSL “sketch” (what Arduino calls a program). The sketch can be obtained from the Downloads page on this website, or from GitHub.

  1. Unzip the download and put the folder named “OpenSourceLights” into your Arduino “Sketches” folder. This may be a place you specified or it may be the default location that Arduino chose when you installed the IDE. If you are unsure where Arduino thinks your Sketches folder is:
    • Open the Arduino IDE
    • Go to File → Preferences
    • At the top of the popup screen that appears, look at the path under the heading “Sketchbook location”. This shows you where your Sketches folder is.

  2. Open the sketch through the IDE or just by clicking on any of the .ino files in the OpenSourceLights folder. Now let's make sure the IDE is setup to compile the project correctly:
    • In the IDE, go to the Tools menu and select Board → Arduino AVR Boards → “Arduino Nano.” In fact several boards would work, but “Nano” is the easiest to remember.
    • Make sure we have the correct processor selected. Go to Tools → Processor → and select “ATmega328P”. Some users may need to select “Atmega328P (Old Bootloader)“ if they have problems loading the sketch onto their device.

      Board and Processor selection

  3. Compile. This is done by clicking the checkmark button at the top left of the IDE window, or by going to the Sketch menu and clicking “Verify/Compile.” The IDE will run for a few moments then give you the results of the compilation at the bottom of the screen. If successful, it will look something like this: Compilation success
    The numbers and percentages will vary as we update the firmware over time, but the important thing is that we don't see any error messages (which would have appeared in red text). Now you are ready to modify the sketch so that it does what you want! Read the section about Modifying the Sketch for instructions.

Loading Firmware on the OSL Board

The OSL board doesn't have onboard USB so you need to load your sketches using an “FTDI cable” or “FTDI Adapter”. The cable has the FTDI device built-in, the device simply requires that you provide a standard USB cable. These are widely available from a variety of sources around the globe, Amazon often has some if you simply search for “FTDI adapter.” Here are some suggestions:

Adafruit FTDI Cable
Adafruit FTDI Friend

SparkFun FTDI Cable 5V
SparkFun FTDI Basic Breakout

FTDI TTL-232R-5V (Part #2419945)

I personally prefer the adapters over the all-in-one cables because I can leave the adapter plugged into the OSL circuit while doing testing and setup. It is much easier to plug and un-plug a USB cable than the FTDI connector. Once you are done with setup and OSL is finally installed in your car, you can remove the FTDI breakout board and use it for your next project.

FTDI examples

Sample FTDI devices

Warning! The FTDI cable/adapter must be plugged in correctly. Align the Black wire of your FTDI with the “BLK” mark on the OSL board and the Green wire with the “GR” mark. FTDI orientation

Adafruit FTDI Friend plugged into OSL 1.7 board - notice the correct alignment of “BLK” - “BLACK” and “GRN” - “GREEN”

Power Considerations when Programming

When the OSL board is plugged into your computer via the FTDI cable it is receiving 5 volts from your computer. When the OSL board is plugged into your receiver, and your receiver is powered (typically through your ESC), then it is receiving 5 volts from your receiver.

Although I have had both sources connected simultaneously and have yet to experience any negative results, it is really best to power the board from only one source at a time. If you are going to connect the OSL board to your computer, disconnect the battery from your ESC first.

The other thing to point out - when you power the OSL board from the computer, the 5 volts from the USB will power not only the OSL board but also your receiver, your servos, lights connected to the OSL, etc… The current from your computer USB port is usually limited to 500mAh. If you have a lot of servos and other peripherals connected, then your receiver/OSL may attempt to draw more than 500mAh, when this happens the receiver and/or the OSL can “brown out” and reset. In that case you may get erratic behavior, or be unable to program new firmware updates to the board.

If this happens to you, try disconnecting your steering servo or other peripherals.

wiki/otherprojects/osl/install.txt · Last modified: 2021/04/09 15:55 by opadmin