Arduino IDE Lab
previous lab | lab schedule | next lab
- Before opening the Arduino software, wire up the Arduino according to the circuits page using the 8MHz minimalist breadboard circuit but with a 10k pull-up resistor on the reset pin (physical pin 1). Call an Instructor over to check your work before powering the circuit.
- Before doing the next step, check that it hasn't already been done by navigating to My Documents\Arduino\hardware and looking for a folder called breadboard. If it is there, skip the next step.
- Go to the mae-server (Win+R, "\\mae-server\Micro\Software"), open the Arduino breadboard folder, copy the hardware folder into My Documents\Arduino.
- Plug in your FTDI serial cable into a USB port on the front of your computer. Give it a few seconds to find the hardware.
- Open the Arduino software (there should be a shortcut on the desktop). Ignore updates if your software is version 1.0.3 or newer.
- Once open, go to Tools, Board, and select at the bottom "Atmega328 on a breadboard (8 MHz internal clock)". Under the same Tools menu, go to Serial Port and select the FTDI serial port (number usually greater than 4, rarely 1 or 2). This should be the same port you were using for the ACIA test. Now you are ready to upload a "sketch" (small user program).
- Try modifying the Basic Blink example to flash on for 100msec and off for 1000msec. Call an Instructor over to brag about your accomplishment.
- Write a program that changes the brightness intensity of an LED you wire up to "pin 11". How it changes brightness is up to you but it should be hands off. Be aware that pin 11 in the Arduino software is not physical pin 11 of the Atmega328p! Feel free to call over an instructor and show off. When doing this have your Oscilloscope connected and displaying the waveform.
- Wire pin 8 to a data switch on your trainer and write a program that depending on the state of the switch, sets a servo position on pin 9 to either 0 or 180 (the servo library is necessary). Power to the servo should be decoupled with a large capacitor. Without it, you risk drawing too much current over a short period of time which can easily reset the ATmega328. The best practice, but not necessary for this lab, is to have a dedicated power for your motors. Keeping in mind that standard servo's do not tolerate more than 6 volts. Use your Oscilloscope to look at the servo signal. Call over an Instructor to again show off.
- Using the serial monitor that is built into the Arduino IDE (Integrated Development Environment, aka desktop software), write a program that reads in a value and echoes back the same value. Note that it should not keep sending the last received value. It should only send once!
- You are now ready to hookup the Arduino to your Vector board computer and communicate between them. The Vector board computer gets information from the signal sensor board (rest of the test stand) which can then be sent straight through to the Arduino to interpret. An example of this would be the train that is in the North block. Instead of just sending it to the TIL displays it can also be sent to the Arduino which you might be using to control switches or track power on sections of your project board.