Saturday, April 5, 2025

13.2: motor labs

 1. Using transistors to turn things on and off (first LEDs, then motors). 

-Transistors help with switching power to devices that require more power or current than what the arduino can safely supply. We are working with a PN2222 transistor.

In the examples below, we are using the transistor to either flash the LED bulb on and off; or fade gradually between 0 and full brightness. 

The simple LED blink example that's preloaded into the Arduino IDE works with the transistor; to add the fading component, we simply use a PWM pin to modulate the LEDs invisible blinking at different rates to create different brightnesses.



Similarly, we can use the transistor to turn a motor on and off:


The same circuit and code as the blinking LED can be used, except for the fact that different values of resistors are used because the two plugins require different levels of voltage. 


2. Using relays to control motors

A relay uses electricity to mechanically move a switch so that of two circuits can be connected by it, one will always be on and the other off; or vice versa. When talking about relays, the number of "throws" refers to the possible number of outcomes caused by the relay. An "on or off" possibility would be single throw; more complex possibilities like differing modes is double throw. "Poles" refer to the number of electric paths that can be switched simultaneously.

This is a circuit I made with the relay that came in our kit; I was able to get the relay clicking, which indicated that its switch function was working. However, because it wasn't fitting in the breadboard properly, which caused issues with ground connection, I couldn't get it to control the motor.


3. Using a wall adapter

We also worked on using 5V wall adapters that can supply current to a motor that might be attached to the same breadboard as an Arduino, but that the Arduino itself cannot safely supply enough current to. The wall adapter outputs to a plug that fits into a jack on a board that came with our kit. To circumvent some impracticalities of that board, we soldered wire to the ground and 5V pins on the board so that they could be stuck directly into our breadboard.

Here's how the circuit looked:

The red/orange/brown wire connects to a motor. 


And here is the servo working!:



I tested, and the motor cannot run without the arduino being plugged into a power source because it needs to be up and running so that it can give instructions to the servo. If the wall adapter is unplugged, the motor runs for a brief moment still, but then comes to a stop. 








No comments:

Post a Comment

Note: Only a member of this blog may post a comment.

14.1 project 2 prototypes/planning

I began prototyping this week by mapping out all the individual elements I need to construct for my seed growing lamp, which has become some...