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. 








13.1: project 2 updates

I've narrowed down the focus of my project to be a hybrid between an automated grow system and a household lamp. The main components will be:

   ✦ a lamp that contains an automated/timed grow light at the top and a base to hold growing "cartridges"

   ✦ growing cartridges: a shallow box in a unique shape that can be placed inside and removed from the bottom of the lamp; they'll be filled with growing media and wildflower seeds so that the lamp can act as a seed starter

   ✦ a reservoir below the cartridge to contain runoff water so that it can evaporate

   ✦ a water tank below the lamp, but connected to it with a tube, to provide water supply.

Most of these aspects can be pulled off with simple objects/electronics I have on hand. The most complicated will be a water pump. Since such a small amount of water is needed for the seeds, a low-power/low-tech pump will work. I've ordered this one from adafruit:

https://www.adafruit.com/product/4547


I have leftover wood from my first project, quite a bit of it, so I am going to use that for the structure of my lamp: I really enjoyed using the shop tools and designing for both aesthetics and practicality last time. 



The overall concept behind this work is that something that is used anyway, a lamp in the home, might also have some small environmental payoff just by being used regularly. I am imagining the lamp as a kind of wildflower factory, where I perpetually produce new wildflower sprouts that I can take into the world and plant.



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...