Lab 4.4 Arduino Microcontroller, Resistors, and Simple Circuits A microcontroller is a "brain" of a mechatronic system that interfaces sensors with a computer. Microcontrollers can perform math operations, take sensor readings, monitor analog and digital inputs, and control analog and digital outputs (take actions based on the inputs). We will be using Arduinocompatibile microcontrollers because they are easy to use for those with no previous electronics experience, inexpensive, cross-platform and open source. Searching the web we can find a multitude of Arduino projects: robotics, smart devices, and musical devices. The Arduino family is composed by several boards; we will be using an Uno compatible board manufactured by Sparkfun called the Redboard. All Arduinos share the same programming language and have a free Integrated Development Environment (IDE) available for Windows, Mac OS, and Linux. Task 1. Use an Arduino and Breadboard to Examine Resistors in Series and Parallel What you need: Three (3) 10kΩ resistors (in Arduino Kit) A multimeter A breadboard (in Arduino Kit) A solderless breadboard is a great tool for making temporary circuits and prototyping without soldering. Our breadboards have horizontally connected rows, and power rails that run vertically along the sides. Pictured is the front and back of a breadboard with the backing removed so you can see the connections between the horizontal rows and the power rails. Typically the (+) power rail is connected to power in your board and the (-) power rail to ground (GND). The Arduino itself usually gets its power from the USB port on a computer. You can also use an external power supply such as a battery pack or a wall wart. Horizontal rows are separated by a ravine, so the left and right side of each row is not connected. Notice the left power rails are not connected to the right power rails. The numbers and letters marked on various rows and columns don t serve any purpose other than to help guide you when building your circuit. Page 1 of 6
Resistors in Series Using your breadboard, place one 10kΩ resistor as indicated in the figure and measure with a multimeter. Yes, it should say ~10kΩ. Place another one in similar fashion but with a lead from each resistor connecting electrically through the breadboard and measure again. The meter should now say something close to 20kΩ. Try with a third resistor in series. Record your results. You may notice that the resistance you measure might not be exactly what the resistor says it should be. Resistors have a certain amount of tolerance, which means they can be off by a certain percentage. Thus, you may read 9.8Ω or 10.1kΩ. Resistor Configuration - Series Calculated Resistance Measured Resistance 10 kω 10 kω + 10 kω 10 kω + 10 kω + 10 kω LIGHT UP AN LED Place an LED lightbulb in your breadboard. Use a wire to connect the long leg of your LED to the 5 Volt channel on your Arduino. Use another wire to connect the short leg of your LED to top leg of your top resistor. Use a third wire to connect the bottom leg of the bottom resistor to the GND terminal on your redboard. If you haven t already, plug the usb cable into your Board and the other end into your laptop. Your LED should light up. Move the wire so the circuit is going across just two resistors, or just one resistor and observe the changes in the brightness of the LED. An LED is a Light Emitting Diode. Diodes allow current flow only in one direction. The long lead is the positive side of the device. Most components are diodes with a positive side labeled. Wire your circuits properly. Diodes can t be reversed. You need to use a resistance of at least 140 ohms to prevent LEDs from burning up. Page 2 of 6
Resistors in Parallel Now try resistors in a parallel configuration. Place one 10kΩ resistor in the breadboard as before. Place a second 10kΩ resistor next to the first, taking care that the leads of each resistor are in electrically connected rows. Calculate what the new value should be (hint: it s going to be 5kΩ). Repeat with 3. Parallel Calculated Resistance Measured Resistance Wire your parallel resistors to your LED and record your findings Table 3. Adding additional resistors in series increases / decreases brightness of the LED Adding additional resistors in parallel increases / decreases brightness of the LED Page 3 of 6
Task 2: Investigate Kirchoff s Laws through Calculations and with your Arduino Use Kirchoff s Laws to Analyze the Circuit Below. Label your voltage loops and label resistors with + and -. W W I 1 I 3 W I 2 Calculated Currents I 1 = I 2 = I 3 = After you calculate I 1, I 2, and I 3, build the Circuit on your Arduino (continued on next page) Page 4 of 6
Measure I 1, I 2, and I 3. Set the multimeter to ma. To measure current your multimeter needs to be in line with the circuit, acting as a wire in the circuit. You need to cut the circuit and connect one probe to each of the cut ends: Remove the breadboard end of the wire, hold one lead of the multimeter to the wire, and the other lead of the multimeter to the end of the resistor. Measured Currents I 1 = I 2 = I 3 = Continued on next page Page 5 of 6
Task 3: Get the Arduino IDE If you haven t already, download the Arduino IDE from this website: https://www.arduino.cc/en/main/software Scroll down to Download the Arduino IDE and select your operating system from the choices. Install the Arduino IDE. Restart your computer and open the Arduino environment (the blue Infinity symbol with the positive and negative symbols in the center.) If all went well you should see an editor window like this: Navigate to the Boards manager by going Tools - Board Board Manager. Select Uno. Check to ensure you have the correct drivers to connect your laptop to your board. Plug the usb cable into your Board and the other end into your laptop. From the tools menu, select port. In windows look for a com port numbered above 3. For Mac it will be a /dev/cu.usbserialxxxxx(some hex #) Depending on your operating system, you may need to install additional drivers. https://learn.sparkfun.com/tutorials/how-to-install-ftdi-drivers http://www.ftdichip.com/drivers/vcp.htm Page 6 of 6