Analog output

This is called pulse width modulation (PWM). The resulting average voltage is sometimes called a pseudo-analog voltage.

The Arduino boards have a few pins which can generate a continuous PWM signal. On the Arduino Nano 33 IoT. they’re pins 2, 3, 5, 6, 9, 10, 11, 12, A2, A3, and A5.

analogWrite(pin, duty);

duty is a value from 0 – 255. 0 corresponds to 0 volts, and 255 corresponds to 5 volts. Every change of one point changes the pseudo-analog output voltage by 5/255, or  0.0196 volts.

Filter Circuits:

The relationship between the frequency blocked, and the values of the capacitor and resistor is as follows:

*frequency = 1/ (2π resistance * capacitance)

speaker:

PWM: constant frequency, wont change the pitch

Screen Shot 2022-09-25 at 11.32.41 PM.png

Tone Output Lab: Servo Lab:

WechatIMG13.jpeg

WechatIMG16.jpeg

WechatIMG14.jpeg

My project: Use a Force Sensing Resistor to control a chain of LEDs.

sd1664305230_2.MP4

I used the potentiometer to control the servo instead of FSR, so I do not actually need to place the resistor on the board. If I change to FSR, I will need to apply for a 10k ohm resistance to get it to work.