• Document: Module: Arduino as Signal Generator
  • Size: 528.85 KB
  • Uploaded: 2019-02-13 17:54:42
  • Status: Successfully converted

Some snippets from your converted document:

Name/NetID: Teammate/NetID: Module: Arduino as Signal Generator Laboratory Outline In our continuing quest to access the development and debugging capabilities of the equipment on your bench at home – Arduino/RedBoard as signal generator. If you have followed the progression of the – Arduino as Bench Equipment – modules you should now be able to supply 3.3V, 5V, and the battery voltage to external circuitry and to use the analog input pins to read voltages at different points in a circuit. Using the Digital Input/Output (I/O) pins you can craft a time-varying signal. Since the outputs are digital the voltage signal is either 5V or 0V so the resulting signal is a train of pulses of – a square wave. A square wave with a fixed period and a variable duty cycle can be generated with a single statement. Pulse Width Modulation is a technique that uses the variability of the duty cycle to control the behavior of circuit components like the brightness of an LED or the speed of rotation of a DC motor. Notes: The Digital Output Pins on the Arduino/RedBoard There are 14 pins available that are digital pins and can be configured as either Inputs or Outputs. The distinction between analog and digital refers to the nature of the voltages. All voltages are analog in the sense that they are continuous in time and can vary in value. What distinguishes a digital signal is that the voltages are assumed to take one of two values. For the hardware on the Arduino/RedBoard one value is 0V designated LOW when setting the output levels in the code, and 5V designated HIGH in the code. The digital output pins are very good at providing a reliable digital signal with only these 2 possible voltages. On input, since the board has no control over the external signals connected to a digital input pin, the distinction is more complicated so that a range of voltages are considered to be LOW and a separate range is considered to be HIGH. Figure 1: Physical layout of the RedBoard. Arduino as Signal Generator Notes: Generating a Square Wave Using a very simple program you can generate a variable duty cycle square wave on any of the digital pins marked with a ~ next to the pin number. Because a common use for these signals is to control the behavior of devices like the motors where the speed is directly proportional to duty cycle the pins with the ~ are labeled PWM or Pulse Width Modulation. You will use this method in a later lab. Question 1: Which of the digital pins can be used to generate a square wave? ü Below is the bare minimum code needed to output a square wave using the digital I/O pins. Open a new ‘sketch’ (the Arduino calls new code files sketches) and type in these few statements. Question 2: This program has no comments so navigate to the Arduino site – arduino.cc. Using the help section indicate purpose of the statements pinMode and analogWrite by adding comments into the code. Include a copy Arduino as Signal Generator Notes: of your results – you may write them if you wish or print a copy but they must use the proper comment format. Explain why the PinMode command is not really necessary. ü After checking under the Tools menu that the software knows which board you are using (the RedBoard is a clone of the Arduino Uno) and which COM port you are using to upload the program to the board by clicking the icon at the top of the window. NOTE: When you plug the USB cable into the lab computer the associated COM port is usually the highest numbered port. For Mac users the USB communication ports are the device file names. Question 3: Once the program has loaded, using c

Recently converted files (publicly available):