Question

Create the following circuit using Arduino Uno board in Tinkercad and write the corresponding codes; 1-Select a DC motor with an encoder. Write code to count the encoder pulses in quadrature mode using INTO and INT1 interrupts. 2-Control the motor using analogWrite function (pin 9) with a duty cycle of 60%. 3-Create an interrupt using Timer 2 that triggers every 1 ms. 4-Add a button (pin 7) and write a debounce function with a debounce time of 100 ms. Add an LED (pin 13\--on board led). Write flash_led_control(int on_time, int off_time) function that flashes in a pattern of 500 ms on - 1000 ms off when the button is pressed, and 1000 ms on - 500 ms off when the button is not pressed. Do not use delay function for debounce and flash led control function. 5-Write a function Adc_init(int reference, int channel) that selects the desired ADC channel and reference, and starts the ADC conversion and returns the result using Adc_read() function. 6-Choose a temperature sensor and configure the ADC module using Adc_init function with AREF pin connected to a power supply with 2V, and channel 0. Use Adc_read function to sample the temperature sensor at a rate of 1 ksps. Apply a moving average filter (window length 50 samples) to the sampled data, and calculate the temperature using curve fitting (-20, 0, 20, 40, 60, 80 degrees). 7-Provide an audible warning using a piezo element with a relay (pin 12) when the temperature goes above 50 degrees. 8-Send the calculated temperature and encoder results to the serial monitor every 500 ms.

          Create the following circuit using Arduino Uno board in Tinkercad and write the corresponding codes;
1-Select a DC motor with an encoder. Write code to count the encoder pulses in quadrature mode using INTO and INT1 interrupts.
2-Control the motor using analogWrite function (pin 9) with a duty cycle of 60%.
3-Create an interrupt using Timer 2 that triggers every 1 ms.
4-Add a button (pin 7) and write a debounce function with a debounce time of 100 ms. Add an LED (pin 13\--on board led). Write flash_led_control(int on_time, int off_time) function that flashes in a pattern of 500 ms on - 1000 ms off when the button is pressed, and 1000 ms on - 500 ms off when the button is not pressed. Do not use delay function for debounce and flash led control function.
5-Write a function Adc_init(int reference, int channel) that selects the desired ADC channel and reference, and starts the ADC conversion and returns the result using Adc_read() function.
6-Choose a temperature sensor and configure the ADC module using Adc_init function with AREF pin connected to a power supply with 2V, and channel 0. Use Adc_read function to sample the temperature sensor at a rate of 1 ksps. Apply a moving average filter (window length 50 samples) to the sampled data, and calculate the temperature using curve fitting (-20, 0, 20, 40, 60, 80 degrees).
7-Provide an audible warning using a piezo element with a relay (pin 12) when the temperature goes above 50 degrees.
8-Send the calculated temperature and encoder results to the serial monitor every 500 ms.
        
Show more…
Create the following circuit using Arduino Uno board in Tinkercad and write the corresponding codes;
1-Select a DC motor with an encoder. Write code to count the encoder pulses in quadrature mode using INTO and INT1 interrupts.
2-Control the motor using analogWrite function (pin 9) with a duty cycle of 60%.
3-Create an interrupt using Timer 2 that triggers every 1 ms.
4-Add a button (pin 7) and write a debounce function with a debounce time of 100 ms. Add an LED (pin 13­-on board led). Write flashledcontrol(int ontime, int offtime) function that flashes in a pattern of 500 ms on - 1000 ms off when the button is pressed, and 1000 ms on - 500 ms off when the button is not pressed. Do not use delay function for debounce and flash led control function.
5-Write a function Adcinit(int reference, int channel) that selects the desired ADC channel and reference, and starts the ADC conversion and returns the result using Adcread() function.
6-Choose a temperature sensor and configure the ADC module using Adcinit function with AREF pin connected to a power supply with 2V, and channel 0. Use Adcread function to sample the temperature sensor at a rate of 1 ksps. Apply a moving average filter (window length 50 samples) to the sampled data, and calculate the temperature using curve fitting (-20, 0, 20, 40, 60, 80 degrees).
7-Provide an audible warning using a piezo element with a relay (pin 12) when the temperature goes above 50 degrees.
8-Send the calculated temperature and encoder results to the serial monitor every 500 ms.

Added by Robert R.

Close

University Physics with Modern Physics
University Physics with Modern Physics
Hugh D. Young 14th Edition
AceChat toggle button
Close icon
Ace pointing down

Please give Ace some feedback

Your feedback will help us improve your experience

Thumb up icon Thumb down icon
Thanks for your feedback!
Profile picture
Can you design a circuit that uses information? Create the following circuit using an Arduino Uno board in Tinkercad and write the corresponding codes: 1. Select a DC motor with an encoder. Write code to count the encoder pulses in quadrature mode using INT0 and INT1 interrupts. 2. Control the motor using the analogWrite function (pin 9) with a duty cycle of 60%. 3. Create an interrupt using Timer 2 that triggers every 1 ms. 4. Add a button (pin 7) and write a debounce function with a debounce time of 100 ms. Add an LED (pin 13 - on-board LED). Write a flash LED control function that flashes in a pattern of 500 ms on - 1000 ms off when the button is pressed and 1000 ms on - 500 ms off when the button is not pressed. Do not use the delay function for debounce and flash LED control function. 5. Write a function "Adc_init(int reference, int channel)" that selects the desired ADC channel and reference, and starts the ADC conversion. It should return the result using the Adc_read function. 6. Choose a temperature sensor and configure the ADC module using the Adc_init function with the AREF pin connected to a power supply with 2V, and channel 0. Use the Adc_read function to sample the temperature sensor at a rate of 1 ksps. Apply a moving average filter (window length 50 samples) to the sampled data, and calculate the temperature using curve fitting (-20, 0, 20, 40, 60, 80 degrees). 7. Provide an audible warning using a piezo element with a relay (pin 12) when the temperature goes above 50 degrees. 8. Send the calculated temperature and encoder results to the serial monitor every 500 ms.
Close icon
Play audio
Feedback
Powered by NumerAI
Kathleen Carty Danielle Fairburn
Ivan Kochetkov verified

Supreeta N and 57 other subject Physics 102 Electricity and Magnetism educators are ready to help you.

Ask a new question

*

Labs

-

Want to see this concept in action?

NEW

Explore this concept interactively to see how it behaves as you change inputs.

View Labs

*

Key Concepts

-
Key Concept
Premium Feature
Explore the core concept behind this problem.
Play button
Key Concept
Premium Feature
Explore the core concept behind this problem.
Your browser does not support the video tag.

*

Recommended Videos

-
use-code-composer-studio-integrated-development-environment-ide-base-on-c-code-write-a-msdelay-function-1-using-the-delay-loop-from-the-tutorial-lab-precisely-measure-the-toggling-interval-o-75535

Use Code Composer Studio integrated development environment (IDE), based on C code. Write a msDelay() function. 1. Using the delay loop from the tutorial lab, precisely measure the toggling interval on the output pin connected to the blue LED using an oscilloscope. Use the result to determine the approximate number of loop iterations required to generate a one millisecond delay. // generate delay for (loopCount = 0; loopCount < DELAY_LOOPS; loopCount++) {} 2. Complete the following msDelay() function such that it will delay execution for the desired number of milliseconds: //////////////////////////////////////////////////////////// // msDelay - Function to generate a variable delay // Arguments: ms - The number of milliseconds for the delay // Return Value: none //////////////////////////////////////////////////////////// void msDelay(unsigned int ms) { // loop for the desired number of ms while (ms > 0) { // Add your code here to generate a 1 ms delay ??? ms--; } } 3. Use the program given in the tutorial, but replace the loop that generates the delay with a function call to msDelay(ONE_SEC). You will need to set the period for the ONE_SEC in milliseconds. 4. Set the red LED to toggle at a one-second interval and run your code. Observe the output on an oscilloscope to verify functionality. 5. Rewrite the traffic light program from the tutorial lab using the msDelay() function. Monitoring Inputs: Note that SW1 will work as expected, however, bit 0 of Port F is "locked" and you will need to add the following two lines of code before you initialize the Port F registers for SW2: GPIO_PORTF_LOCK_R = GPIO_LOCK_KEY; GPIO_PORTF_CR_R |= SW2; Programming Problem: Write a program that simulates a pedestrian-controlled traffic light. The light flashes green with an interval of half a second. If the SW1 button is pressed, the light changes to yellow for 1 second, then turns solid red for 5 seconds. After the 5 seconds, the light returns to the default state of flashing green. Note that if you quickly press the button while the LED is flashing green, it may not detect the button press and activate the signal. Why do you think that is? What is the minimum length of time you must hold the button down to guarantee that the button press is detected? Buttons Pressed: RGB LED Output None: Off SW1 only: Red SW2 only: Green SW1 and SW2: Blue

Supreeta N.

1-objectives-1-to-play-different-tunes-on-a-speaker-or-piezo-sounder-2-to-use-the-arduino-sound-library-ii-theoretical-background-sound-waves-are-vibrations-in-the-air-pressure-the-speed-of-03397

I. Objectives: 1. To play different tunes on a speaker or piezo sounder. 2. To use the Arduino sound library. II. Theoretical Background Sound waves are vibrations in the air pressure. The speed of the vibrations (cycles per second or Hertz) is what makes the pitch of the sound. The higher the frequency of the vibration, the higher the pitch. Middle C is usually defined as a frequency of 261 Hz. If a digital output turn on and off again 261 times every second then that output will be middle C. To hear the output, it need to attach something that will convert the electrical signal into sound waves. This can be done with a loudspeaker or a piezo sounder. Piezo sounders use a special crystal that expands and contracts as an electrical signal passes through it. This will generate a tone that we can hear. The most commonly used methods in playing a sound are listed below. • tone(pin, frequency) or tone(pin, frequency, duration) - generates a square wave of the specified frequency (and 50% duty cycle) on a pin. A duration can be specified, otherwise the wave continues until a call to noTone(). The pin can be connected to a piezo buzzer or other speaker to play tones. • noTone(pin) - stops the generation of a square wave triggered by tone(). Has no effect if no tone is being generated. III. Materials: 1 x Arduino Uno board and USB cable 1 x 5V Speaker or Piezo sounder 2 x tact switch 2 x 470 Ή resistors 6 x LEDs 1 x breadboard Connecting wires IV. Procedure: 1. Construct the circuit using the Arduino Uno, Breadboard, speaker, LEDs, resistors and tact/toggle switch. 2. Create a program that generates a tune whenever the tact switch is pressed (in latch states). Define your own tune frequencies for each of the 2 tact switches. The tunes should not finish playing whenever pressing each switch. The 6 LED's will lit according to the tempo of the tune. V. Circuit Diagram VI. Actual Diagram

Adi S.

question-one-a-an-analog-to-digital-converter-adc-measures-voltages-in-the-range-of-0-to-25-v-and-has-12-bit-accuracy-what-is-the-smallest-voltage-step-that-the-adc-can-resolve-b-a-ramp-type-04248

a) An analog-to-digital converter (ADC) measures voltages in the range of 0 to 25 V and has 12-bit accuracy. What is the smallest voltage step that the ADC can resolve? b) A ramp-type ADC system uses a 10 MHz clock generator and a ramp voltage that increases from 0 V to 1.25 V in a time of 125 ms. Determine the number of clock pulses counted into the register when V = 0.9 V, and when it is 0.75 V. c) If 3.45 V is applied to a 4-bit successive-approximation-type A/D converter which has a reference voltage of 5 V, what will be the digital output of the ADC? d) An 8-bit ADC is converting a temperature signal which has a measuring range of 0 °C to 800 °C. Calculate the resolution of the temperature-measuring instrument. e) Determine the number of output bits required for an ADC so that quantizing error is less than 1%. f) The resistance of a thermistor is 800 Ω at 50°C and 4 kΩ at the ice point. Calculate the characteristic constants (A, B) for the thermistor and the variations in resistance between 30°C and 100°C.

Adi S.


*

Recommended Textbooks

-
University Physics with Modern Physics

University Physics with Modern Physics

Hugh D. Young 14th Edition
achievement 1,482 solutions
Physics: Principles with Applications

Physics: Principles with Applications

Douglas C. Giancoli 7th Edition
achievement 1,213 solutions
Fundamentals of Physics

Fundamentals of Physics

David Halliday, Robert Resnick , Jearl Walker 10th Edition
achievement 1,687 solutions

*

Transcript

-
00:01 Hello student, to precisely measure the toggling interval on the output pin connected to the blue led using an oscilloscope, follow these steps.
00:11 Connect the oscilloscope probe to the output pin connected to the blue led.
00:15 Number 2, set the oscilloscope to the trigger on the rising edge of the signal.
00:20 Set the oscilloscope to measure the time between the rising edge.
00:24 Now start the oscilloscope and run the code that generates the delay.
00:28 Observe the oscilloscope to measure the toggling interval.
00:32 The approximate number of the loop iteration to generate a 1 millisecond delay can be determined by dividing the toggling interval by the loop count.
00:43 So this can be, this can generate the delay.
00:46 So here to complete the msdelay function, add the following code to the loop.
00:52 So we can add this to generate a 1 millisecond delay.
00:57 The assembly code will cause the cpu, this is assembly code.
01:02 This assembly code cause the cpu to enter a low power state of 1 clock cycle.
01:08 The number of the clock cycle per millisecond will vary depending on the cpu clock frequency.
01:14 However, in the mos cpu, the number of the clock cycle per millisecond is approximate 1000.
01:21 Therefore, the above assembly code will generate a delay of approximate 1 millisecond.
01:27 So with the help of this, we can generate the delay.
01:30 To use the msdelay function to replace the loop that generate the delay in the program given in the tutorial, simply change the loop to the following, msdelay 1 underscore second.
01:42 So 1 underscore second macro should be defined to the number of the millisecond in 1 second...
Need help? Use Ace
Ace is your personal tutor. It breaks down any question with clear steps so you can learn.
Start Using Ace
Ace is your personal tutor for learning
Step-by-step explanations
Instant summaries
Summarize YouTube videos
Understand textbook images or PDFs
Study tools like quizzes and flashcards
Listen to your notes as a podcast
Continue solving this problem
Create a free account to:
  • View full step-by-step solution
  • Ask follow-up questions with Ace AI
  • Save progress and study later
Continue Free
Join the community

18,000,000+

Students on Numerade


Trusted by students at 8,000+ universities

Numerade

Get step-by-step video solution
from top educators

Continue with Clever
or



By creating an account, you agree to the Terms of Service and Privacy Policy
Already have an account? Log In

A free answer
just for you

Watch the video solution with this free unlock.

Numerade

Log in to watch this video
...and 100,000,000 more!


EMAIL

PASSWORD

OR
Continue with Clever