My son got an Arduino as a present from a friend. We built “blinky” but then I was a little stuck on where to go next, because his grandiose imagination went well beyond obvious next steps. But today, I got something right. I broke things up into steps where each step engaged his interest and introduced just a few new ideas to talk about.

  1. Play with motors connected to motors, see which ones work as generators and turn the next motor. (Some kit motors didn’t so probably weren’t PM motors; motors rescued from an old CD player did, stepper motors worked well and were really cool. Try it!)

  2. Use a physical momentary pushbutton switch on the low side of a simple DC motor (we used the ones rescued from the CD player) to switch it on and off.

  3. Put a flyback diode across the motor (use step 0 to talk about why that matters), and use a pushbutton switch to pull up an n-mosfet as a low-side switch for the DC motor, without a pulldown resistor, and watch it not work due to residual charge on the mosfet. (In our case, we started with the gate completely disconnected and the residual charge happened to be sufficient to let the motor run. We used a BS270.)

  4. Add the pulldown resistor to the mosfet gate, watch the pushbutton work.

  5. Hook up the mosfet gate to a digital port on the Arduino, turn it on and off with a few seconds of delay using digitalWrite() and delay(). (Choose a port on which PWM is available.)

  6. Introduce analogWrite() in arduino, and try different speeds with delays between settings to determine the minimum duty cycle to make the motor turn.

  7. Hook up a potentiometer to an analog port, and just analogWrite(digitalPin, analogRead(analogPin)) and demonstrate what happens when you don’t scale 10 bits of data to 8 bits of control. (For those who haven’t tried this, the extra two high bits are ignored, so the speed ranges from minimum to maximum four times during the sweep of the potentiometer.)

  8. Divide the input by 4 and see the difference.

  9. Print out the output (PWM) values in the loop, and see that what we learned way back in step 5 about minimum duty cycle is why the lower ~eighth (in our case) of the potentiometer sweep doesn’t result in the motor turning.

  10. Listen to the motor through the sweep of the potentiometer, including when the motor isn’t running. (The base frequency stays the same but the sound changes as the duty cycle changes.) Mention magnetoresistive heating.

That was enough for one day.


Imported from Google+ — content and formatting may not be reliable