Our instructors be like:
let's begin
This week focuses on logic circuits. They are very commonly used as you can not use a microcontroller for simple tasks such an example is watching the temperature and when it falls below specified temperature t sends a signal to power on the heater, if we said that we can build such circuit with less than 20 L.E but with the microcontroller, we cost around 100 LE, some big deal!
another one is to extend microcontroller GPIOs as you want NOT to buy a bigger chip or make a sensor controller or use a LED matrix.
those are simple examples I used, and there are lots other than what I mentioned
The logic components we will use are as follows;
74151 (8 Input Multiplexer)
74595 shift register
UA741 op-amp
definition by Wikipedia: In electronics, a multiplexer (or mux; spelled sometimes as multiplexor), also known as a data selector, is a device that selects between several analog or digital input signals and forwards the selected input to a single output line. The selection is directed a separate set of digital inputs known as select lines. A multiplexer of 2 power n inputs has n select lines, which are used to select which input line to send to the output.
First, Download the datasheet then follow
connect VCC to 5v, GND, the 3 selective pins that make you select the desired sensor (A,B,C), and obviously the output pin that output the selected sensor reading (Y)
that table shows everything. remember to connect G to GND
For Eagle, you have to invoke VCC, GND in order to work properly
definition by Wikipedia: An operational amplifier (often op amp or opamp) is a DC-coupled high-gain electronic voltage amplifier with a differential input and, usually, a single-ended output. In this configuration, an op amp produces an output potential (relative to circuit ground) that is typically 100,000 times larger than the potential difference between its input terminals. Operational amplifiers had their origins in analog computers, where they were used to perform mathematical operations in linear, non-linear, and frequency-dependent circuits.
That explanation is a pain in the head and how op amps work is so hard to understand
BUT, I will make it easy on you. I will just use at comparator. and in order to do that we will make a very simple connection
Think of it as 1 input and 1 output and a reference value to compare to, simple VCC and GND
for the reference (the non-inverting) we will make a simple adjustable voltage divider by a trim pot
for connection jump to the datasheet
First of all, reach the datasheet and follow with me
the big difference here is how it works. it is called Serial In/Serial or Parallel Out Shift register as you insert bits sequentially.
*In eagle design use invoke to use the vcc and gnd pins
connect G to GND and SCL to 5v in order to make it running properly.
now the remaining pins are SER, SCK, and RCK
As we see in the animated gif, the data is sent in serial as 8 bits and the latch pin makes the stored bits come as output
you can control PWM with the enable output pin but that will change all the pins at once
now its time to build our logic circuits
Input means that we are going to use mux, we will make a circuit with op amp to make a change in the signal if temperature fall below the specified limit, the specified limit will be adjusted by a trim-pot, we will add a 4 dip way switch to test the features of the mux
For the simulation and circuit explanation of the circuit, I can NOT override our instructors' videos, here are the videos, please click the following and enjoy:
Schematic is no done, Time for board design,
fabrication and CAM files with the PNG is now yours
For the code I will read the status of the pins and print them to the serial monitor, I will use Arduino Uno to watch the pins' state
In the code, I used a simple bitRead function to easily manipulate sensor readings and printed them to the serial monitor
You will find the code link below with the testing
For the output, I only need to light an RGB lamp and high power outage with a help of a MOSFET!
for that, I will use a 4 pin output
For more explanation on how shift registers work please jump above and see the documentation!
this circuit is more simple than the input
No more explanation needed I think
No code for this stage but after fabrication, we will make smart interaction between these two boards!
Schematic is no done, Time for board design,
fabrication and CAM files with the PNG is now yours
(again!)
the Output board was done easily but the Input board had some issues during the fabrication, the PCB milling machine was too crazy, it ruined my PCB twice, it did not back to its original one time. the other time it passed steps and ruined all traces
So I went to the OpenBuilds machine and inserted an unmirrored version of the drills and it ruined it again
So, the last try was during the closing time. I had to fabricate the full board in 15 min. and I succeeded!
Soldering through all was quite easy so I did not have any issue
*The fabrication files will be found above.
testing first the Output board.
Adjusting the trim pot to be the same reference as the room temperature
uploading the code ( link is above )
play with the dip switches
watch the serial monitor
For the microcontroller, I could not use the ATtiny board as I took a resistance from it to complete the group PCB! then I will be using Arduino UNO and that is handy as now I can use the serial monitor
The second step is to make a smart combination between the two boards, I will light high power LED on the OUTPUT if the temperature rises above the pre-specified temperature
The boards when i soldered i got sure that nothing is short circuit and made sure that all soldered well, then i made a very stupid move....
I used scissors to cut the long legs and that made some traces pop out and dis-attach, i spent 3 hours trying to figure out why it is not working!
then, Never ever use scissors after soldering!