Sunday, January 27, 2019

Lab 11 - Microcontrollers, Input and Output

1/24/19

Microcontrollers: has an output depending on what input is received and what the command program tells the controller on what to do. A controller can receive an output such as a switch or varying resistance, in which the program will read and interpret that data. The program will then set an output (again, depending on the programming) which will produce a desired result. In this first part, we are utilizing an LDR to get a output of a number value that is representing on the amount of light in the room. That number, varying degree of light/darkness, will then be read in the controller in which  the program will turn on a certain amount of LEDs. Those LEDs are serving as light intensity indicators.
LED OFF cuz it is bright at sensor
LED ON cuz its dark at sensor

























The picture below shows multiple LEDs. Varying darkness changes which and how many LEDs gets lit. Sadly the video could not fit here.


Motion Sensor
Thankfully a motion sensor was able to be installed and it operated perfectly. It outputs a +5V signal when motion is detected. All in the programming of the arduino.

Lab 10 - Using the Serial Port

1/22/19

Serial port in an microcontroller is very useful in getting values. Values, for what? There are sensors that will be connected to the analog port of the microcontroller which when given the command serial print read, the computer monitor will display the value that the microcontroller is seeing from the device connected to the port. The picture below shows a LDR (Light Dependant Resistor) that has a different resistance value depending on the amount of light that reaches the sensor, hence Light Dependant. The microcontroller on the analog port will be able to read the value, and the program can use that value to control whatever we command the controller to do.
LDR Hooked up





















Serial connections has a Receive and a Transmit pin. There is also a shared pin of common Ground Reference. The arduino microcontroller in this setup will receive intel from the computer's keyboard, and transmit a command to the computer monitor and the arduino's pins. In the picture below, the computer keyboard is entered with a 1 or a 0, in which the arduino reads it, and on the code, the LED will turn either ON or OFF depending on the keyboard stroke entered. #Success




LED hooked up







Lab 9 - Driving Motors and other Output Devices

1/22/19

Controlling loads....hmmmm... how to do it with power....
A microcontroller is limited to 10mA per channel, and the whole chip  capacity is 50mA. That is not much for larger output devices. An idea is for the microcontroller to control a transistor (a power gate) to allow more current to flow to the output; rather than the power coming all form the microcontroller, the controller will control a transistor, in which power will come from the source through the transistor to the output. The transistor also has a limit, but it is much greater than 50mA. Trasnitir is rated to 200mA, that is 4 times more power than the microcontroller!
Microcontroller controlling a transistor to power a Xmas light bulb
Next step, More Power! Lets pile onto that concept. Lets have the 50mA limit microcontroller output to operate a 200mA transistor, in which that will operate a 0.6A medium power transistor....Yes! Great idea, and the microcontroller only needs about 10mA to operate such a chain, called Darlington Pairs. With this setup, we get more light out of this tiny Xmas light bulb. We will later see that all these transistors can be combined in a single package called the TO-92 package with 5A continuous max limit.


Xmas bulb with Darlington Pair
Xmas bulb with TO-92 package









PWM-Pulse Width Modulation
Control a motor with timed ON and OFF square wave pulses rather than varying the voltage. Basic attempt, and it worked! Controlled not with pure voltage, but controlled with the output of timed voltage pulses. 


PWM Controlled Motor



















Saturday, January 19, 2019

Lab 8 - Bi-directional Motor Control

1/17/19

Transistors are great because you can have enough current to turn on a motor. A Circuit was designed using a tiny relay IC in which current will go into the motor and make it spin, but also have current come into the motor on its other lead to make it go the other direction. Relay is a DPDT (Double Pole, Double Throw). 


DPDT Relay circuit Schematic
H Bridge Schematic


A motor can be also controlled using a H bridge configuration. Instead of using a DPDT relay to control, the circuit, we can use an Arduino to control two transistors to allow dc current to flow in one direction, and two other transistors to have the current flow in a different path so it goes in the other way into the motor. 
DPDT Relay circuit
                           
H Bridge Circuit



Lab 7 - Introduction to Microcontrollers

1/17/19

Microcontrollers, it is a computer on a chip. It is low cost, but contains everything that is need to act a s a computer. There are many pins in which they are controlled via programming a arduino. A High state outputs a 3.3V-5V, while a Low state outputs a 0V, which is essentially off. This lab is going to be basic with LEDs. A LED turns ON when there is a High state declared on the corresponding port on the Arduino Board. Simple installation of the program was done. 1..2...3...poff...installed. Now time for programming! Downloaded program for blinking LED. Successful Blinking LED done!

Fun time with Night Rider project. Instead of just one LED, the project is with 4 LEDs that does a "scan" function that is exactly like the night rider car. I had to really review programming in loops to get this part done. Hooking up the circuit is easy, but the programming s the part that took effort. Finally got it running. Simple 220 ohm resistor was used for each LED, and each LED is designated to a single oort on the arduino.
Single LED Hookup
Program Code for Blinking LED Night Rider
Night Rider Set-up


Friday, January 18, 2019

Lab 6 - Transistor Switching


1/15/19

Transistors! huh? Transistors! They are amazing. It is a gateway for electricity. I high current can be controlled with a small current applied to its base. It is very useful for controlling a motor with a signal voltage. This lab shows the current and voltage values of different parts of a transistor in and out of operation. Parts examined includes the Base, Emitter, and Collector. The collector leads towards the Power source. The base is the controlled gateway, and the Emitter is essentially the power output to the load. Notice the picture below is using a switch; the full source voltage is triggering the base to allow current to flow to the LED.

The NPN Transistor is going to be used the majority of the time in this course. There is a PNP transistor which is the same except that the Comitter sand emitter are switched. A transistor is great to control current over a relay because hardly any current is need to activate the base. Since it is electrical, there is minimal, if any, wear. It is a lot more dependable than a mechanical relay as there are no mechanical parts to wear out. A mere 1mA, in this lab, allowed an impressive 14.1mA to flow out.

Transistor Circuit in OFF position
Transistor Circuit in ON Position




Thursday, January 10, 2019

Lab 5 - Switches and Relays

1/10/19

This lab is a nice overview on possible switches available configurations. Poles and throws were covered. Hook ups of 2 way switches was covered simply by following the wiring schematic. Relays were covered in which essentially a low power source activates a coil/solenoid, in which that will close contacts to a seperate circuit( typically a high powered circuit). This device is useful especially for controlling a high powered circuit with a low powered signal. Relay oscillator was studied and learned. It was quite amazing to hear a switch go on/off 50 times each second! That was a recipe for device destruction though. Safety precautions were observed.
Relay oscillator
Relay oscillator with a capacitor

It is worth noting that thanks to the capacitors charge/discharge characteristics, it was so much easier to see the LEDs blinking as now a time delay (or charge constant) was introduced to the circuit.
   


Lab 4 - Schematics, Ohm's Law and Potentiometers

1/10/19

This lab gave us quick knowledge of ground/power symbols, and schematic symbols for those inckuign the potentiometer. A potentiometer is a variable resistor, 3 terminals, 2 of which is the full resistance, while the 3rd terminal(typically in the center) is the wiper that selects a resistance in between. Experimented with LED brightness by changing the resistance. The answer is current! The voltage drop at the LED will not change, but the voltage left over must all be dissipated by the resistor. That combined with ohms law will give us current, which since this is a series circuit, will all pass through the LED. The more current, the brighter the LED will be...except of the current rating gets exceeded, then the LED will blowup....literally!
Pic above: 3 LEDs with 3 different resistors

Pic above: LED in series with a LDR


Lab 3 - Using a Multimeter

1/8/19

Lab 3 is going to be mixed a bit. I used both meters, one from the campus supply, and the other is my personal one. I like using my personal one because it doesn't have any annoying beeps and auto-shut-off noises. The plus side of the one from school is that it is auto-ranging. yay for that aspect. Meter basics of measuring voltage and current, along with continuity and the conditions was explored in this lab. Normal routine meter exercises was done in this lab from measuring DC voltage to AC voltage. Assisted student in understanding the meter and the correct probe position and selection slots.

I really liked this lab because I got exposed to the operation and characteristics of LDR (Light Dependant Resistor), Pressure Dependent Resistor, and a Thermistor (Temperature Dependent Resistor). These sensors will come in handy for robotics later (soon actually) in the semester. Quite useful to see its varying characteristics in action.


Pic above: Measuring a Size C 1.5V DC battery

Pic above: Measuring a 9V DC battery

Pic above: Measuring the 120VAC outlet with an odd number

Pic above: Measuring the 120VAC outlet with the correct value (glitch disappeared)

Lab 2 - Introduction to using a Breadboard

1/8/19

Lab 2 is about using a breadboard. I have had lots of experience with this board, so this was powered through. The lab shows how the breadboard is connected internally. Instead if making wires, I used premade wires from my backpack. #easy Resistor Color code was reviewed and how to read it. Hopefully we are not color blind. XD Used a LED in a very simple circuit to light up. LEDs are polarity sensitive. They will only light up in one direction only. Long lead to the positive side and all will be well.

Picture on Top: Breadboard with a LED in series with a resistor
Picture on Bottom: Resistor Color Code handout chart


Lab 1 - Intro to Soldering and Building Power Supply

1/8/19

Hello Fellow Blogger Reader(s)!

This is my first Blog. I will be blogging in my Mt Sac Class journey of ELEC 10 Intro to Mechatronics class that will be consisting of 17 Labs.

This lab is for soldering, which I skipped. I have many soldering practices before, and took the Soldering Class with professor Joe Denny, best professor ever! Got a pass to skip that lab due to soldering competence. Power Supply creation is a phone charger to be soldered to a wired end. That will be our 5V power supply. Since there are many in the class, they were just distributed out since soldering was skipped in lab.

Picture on Left: Soldering is easy handout in easy steps #Skip
Picture on Right: Pre-made power supply from a 5V phone charger