Weekly Journal – PWM & Motors – Tyler Tilton

Unfortunately I had to miss class on Monday because I was sick, but I’ll explain what I learned from the videos in lieu of pictures of the lab.

Using PWM (Pulse Width Modulation) you can mimic the behavior of an analog output by turning a digital output on and off extremely fast. Doing so causes the average voltage to median out and appear steady depending on the resistance applied. You can do this on pins of the Arduino with the tilde next to them, you’d just use an analogWrite with a pin number and a number between 0 and 255.

I’ve actually worked with tone and piezo speakers before. Over the summer, I had an intro to agriculture class and we had to come up with some experiment to perform on plants. I wrote some Arduino code and set up a piezo speaker and had it sit next to a plant, generating a tone for four weeks to see if it affected growth. (The results were inconclusive, there were too many variables to measure accurately.) Anyway, working with tone and modulation is pretty standard stuff, you just have to map it to a pot or other sensor. You have to be really careful about causing a short with the speaker though as they have very low resistance.

On Wednesday, we talked about motors and servos and we controlled them both with potentiometers.

motor
I’m not sure how well you can see it, but the motor is getting faster as the pot moves up.

We used a digital output and a transistor to turn it on and off.

And here’s the servo,

servo2

servo1

This was also pretty easy, I didn’t really have any issues except that the first time I tried to built the circuit, I had the transistor in backward and blew it. Then I didn’t realize it and couldn’t figure out what happened. (Shout-out to Dexter for helping me out with that!)

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s