OLLYDOTDEV / Project-Birdseye-DTX-2020

The initial plan is to create a device that is made for the sole purpose of a Preemptive Security system for People who work with Confidential/Private Information and need to work on potentially more public places where one cant Guarantee fully secure/discrete room. My Approach to solving this is with a wireless computing node That Takes Sensor data from a variety of senses. Then the Data from the Senses is taken then and processed to determine whether there is a security breach if so then it will Relay that info over to the Raspberry Pi W that then Emulates an HID (Human interface device) Using the P4wnP1_aloa made by mame82 to Execute a custom user-defined action that will be set via Apache server hosted of the Raspberry Pi W Communicating From a web interface back to the purchase server utilizing Ajax
GNU General Public License v3.0
3 stars 1 forks source link

RBG LED’s #6

Closed OLLYDOTDEV closed 4 years ago

OLLYDOTDEV commented 4 years ago

As a user It would be highly convenient to have Device status feedback of the ROM'S So what I Know that is happening and whether the ROM'S is ready to be used

OLLYDOTDEV commented 4 years ago

https://octopart.com/598-8710-307f-dialight-868662#Specs https://octopart.com/598-8710-307f-dialight-868662#PriceAndStock Through many difficulties, I have managed to find CAD models and specs for the SMD RGB LEDs with the Component's name being 598-8710-307F. These LEDs are going to be used to output system status info to the user. Eg when batty need charing (also can send msg back to the computer and makes a pop-up, flash Red)

Design for this PCB is currently underway as LEDs.sch

the dialight LED's I am using happen to have 3 anodes per component once for each RGB LED each of these anodes corresponds to a color, Eg R,G,B meaning to use the desired amount of three RGB LEDs that would require a total of 9 pins (1 per anode) on the ROMS atmega328p without having that amount of pins free it first thought I looked into was having on the additional PCB (as talked about in #5 ) an addition atmega328p microprocessor that acts as a node that branches off the Primary atmega328 allowing for the much-needed pins to control the LED's. https://github.com/OLLYDOTDEV/Project-Birdseye-DTX-2020/issues/5#issuecomment-643613012 will go into greater detail how this will work for connecting the two chips

OLLYDOTDEV commented 4 years ago

I needed a way to control the first method that comes to mind. It is simply just powering the LEDs directly from the main IC(https://github.com/OLLYDOTDEV/Project-Birdseye-DTX-2020/issues/2#issuecomment-643586762 ). There should be there is that the atmega328p that I'm using operates at 5v and that would completely fry the leds as they are rated for about 3.4v

000003_Selection (The part name is DIALIGHT_598-8710-307F we can see that has 3 forward voltage values This is for each of the three colors each there
And each color has a differce volage useds )

OLLYDOTDEV commented 4 years ago

A concept to approach in this issue was a plausible solution using Pulse width Modulation (PWM for short) On a half duty cycle of 5v it would hypothetically could maybe be averaged via a capacitor as seen here. I'm going to be inquiring to the teacher about this So that I can get a solid answer that way I can get a definite answer, ok well yes that has potential there is too many things I could go wrong with acting as an irregular power supply. so after looking into this more yes it might work but firstly it would provide a way too much amperage as the LED at max can only handle 30mA and 5v from the Atmega328p can be at great as 200mA just under 20times. so it would be no good

OLLYDOTDEV commented 4 years ago

https://github.com/OLLYDOTDEV/Project-Birdseye-DTX-2020/iissues/8#issuecomment-643705732 With using the LDO regulators going to control the voltages I can now get back to working out how to control the LEDs as stated in https://github.com/OLLYDOTDEV/Project-Birdseye-DTX-2020/issues/6#issuecomment-643615355 . Whats better to control something then a switch so how about an Electronics switch such as transistors 000004_Selection

In short, a MOSFET is a Fancy transistor

but when comparing the base of a transistor to the Gate MOSFET can be seen that there is actually a physical connection where and drainage from that pin would occur would just be a waste of power. So An alternative is to utilize a MOSFET which utilizes The effect of inducing a current flow via magnetic fields, once though capacitance is charged there's no need to continue providing power as there is no discharge, therefore, there is minimal to no loss-making it super-efficient Circuit

That is why I have picked MOSFET over transistors So I started looking it to information about MOSFET https://oscarliang.com/how-to-use-mosfet-beginner-tutorial/ was a good place that helped me a lot to understand how they worked

OLLYDOTDEV commented 4 years ago

So for starting there are two types n-channel and p- channel There are used in the two Different scenarios given below (info from youtube)

In short, PNP is when the switch is placed be for the connected load, in my case, a MOSFET is out equipment switch. therefor the placed between the VCC of the load as seen here. 000005_Selection where as NPN is the opposite 000006_Selection

There is also the mode that you need to consider as there are two types

I will be going with enhancement-mode MOSFETs as in project is it is battery operated as having a content drain from a depletion-mode MOSFET (these are more like a variable resistor) would be the incorrect use for this component and Inefficient. Enhancement-mode MOSFETsWork by when a sufficient voltage is applied to the gate (the amount of voltage changes from MOSFET TO MOSFET) it will Induce magnetic field in p material as the seen here. 000007_Selection

Which in turn allows for current flow from the source to the drain. - in a circle is repetitive of current flow as electrons are negatively charged 000008_Selection

OLLYDOTDEV commented 4 years ago

So with this in mind this there is more to consider when picking a MOSFET for your project

Gate threshold otherwise knowen as Vgs(th) is a point where the MOSFET will start to conduct current but with high resistance. gate-source voltage is scaled to allowing more current through once your parcel point. eg within a given range more volage at Vgs(th) = Is an inverted depletion curve ratio. Understanding MOSFET On-State Drain-to-Source Resistance - Technical Articles Topic: n-channel / logic level / low Rds MOSFET - and datasheet questions n-channel / logic level / low Rds MOSFET - and datasheet questions - Page 2 Topic: About the good usage of N-channel MOSFET

RDS(on) idea seems simply when the gate is off the resistance between source and drain is extremely high—so high that we assume zero current flow. This scales as more voltage applied to the gate pin the more current can flow through from Source to drain (Until blows itself up due to much voltage, not recommended )

Logic level MOSFET vs normal MOSFET MOSFET Confusion - Logic Level vs. Standard Logic level vs "normal" MOSFETS

to put it simply means what the Mosfet runs from the approximate 3.3 to 5-volt value on the gate to Source Rather than higher values like 10v switch and microcontrollers typically don't normal output natively higher than logic level voltage.

So as long as the RDS(on) Met in the gate is provided sufficient power Then we should be fine This is important as I will be needing To drive MOSFETs at a logic level (3.3v or 5v) so the RDS(on)

Here's a breakdown some Main parameters of a MOSFET 000009_Selection

OLLYDOTDEV commented 4 years ago

Making sure that you use the right specs for a project is important to know. this info can be obtained by looking at graphs. To confirm my finding I talked to someone who works in the electronics industry.

000010_Selection

000011_Selection 000012_Selection 000013_Selection 000014_Selection (Conversation took place 20/02/20: 9:50 pm with A certified electronics engineer with a degree from university who is actively working in the industry as well)

Armed with this knowledge I feel I'm able to make an informed decision on watch component more explicitly which MOSFET would be the best option for my particular use-cases while considering things like budget, usability, flexibility, and accessibility

000014_Selection 000014_Selection

OLLYDOTDEV commented 4 years ago

I will be going a SOT-23 footprint due to its sizes so the two MOSFETS I am looking at getting will both work at 3.3 and 5 Volts making them very Versatile and reusable within this project. for my N channel MOSFET, I will be using a N channel: BSS138 and for my P channel MOSFET, I will be using a P channel: DMN65D8L

OLLYDOTDEV commented 4 years ago

here it was the RBG LED look with when hooked up to MOSFETS within Eagle CAD schematic view (the gate voltage for the MOSFET is driven by the digital pins on the atmega328 ) 000015_Selection

Below is the pinout if the atmega328p The brown pins with 0 to 13 are all digital pins i could use. But due to the fact i am also going to need some of this for the serial interface for connection with the R.O.M.S these pins are the RXD and TXD pins i made a note not to use them 000016_Selection

I have selected pins (D then the number is The corresponding pin on the atmega328p)-(this is the color it is controlling)

D5 - Red - D6 - Green - D7 - Blue -

D8 - Red - D9 - Green - D10 - Blue -

D11 - Red - D12 - Green - D13 - Blue -

As according to this datasheet anyway 000017_Selection

OLLYDOTDEV commented 4 years ago

After used eagle cad to take the prior defined Electrical connection from my schematic file and then used the parts footprints and converted them into a .brd file this file is used for defining the physical relationship for the parts and physical wires.

They started all jumbled but after some Shuffling of parts this is what it looks like 000028_Selection

Here we can see that i cam starting to get the parts into there groups

Eg

Power, Led, io, etc

All the yellow lines that can be seen are called air wires. These are used to Show the electrical relationship between components that define the physical wires between them. the routing tools used to add the physical wires. In a relatively simplistic Circuit like this then you can use a function called autoroute which essentially utilizes the computer to generates the most efficient pass between components without having any overlaps. 000029_Selection

Above you can see the outcome of utilizing autoroute did a pretty decent job of looking at everything consider That I had to place only components in Rough groups.

After revision, I have looked at all other Opportunities to Start shrinking my board design and optimize it more here is the next revision

000030_Selection On the left, I have compressed the headers for selecting the 3.3 volts or the 5-volt RDI as well as trying out a new method of compressing the LEDs and MOSFETs on the right.

000031_Selection

Again compacting the left side down more while trying to maintain it at a scale which I can still realistically make my hand

OLLYDOTDEV commented 4 years ago

Seeing as I want the LED to be flush with the case where I needed to move the led from the top of the PCB (red color) to the bottom (blue color). 000032_Selection

Here on the (image above), I have moved the RGB LEDs to the back as seen in blue. The wires were placed by autorouter and are very messy. The need for the wiring to be tidy is the PCB at a later date. So to achieve this I will wire this by hand.

000033_Selection

The (image above) there is an image of my manually Connected wires that have resulted in a Uniform Circuit Layout. So yes sometimes it does pay to do things by hand. Spark fun guide helped a lot here on how to do a good looking job. If if you compare the image just above to the one above the image that contains all 9 MOSFETs you will see a major difference in the layout 000034_Selection

Here is everything looking nicely wired by hand

OLLYDOTDEV commented 4 years ago

Throughout the process of green the PCB, I may have renamed some names without the schematic editor open therefore they became essentially two different versions of this PCB and the result is that the difference is created and one edited did not sync to the other and earn of this I now have to go through manually fix errors, to prevent this in the future from happing I need to have a feedback loop enabled this can be simply achieved by just have the Schematics editor open as well as the board editor

open at the same time as fixing this was a poor use of my time 000035_Selection GIT[Syncing schematic with board fixed]

000036_Selection

Git[R1 Finish (yet to test)]

Here R1 for LC_board is complete and parts need to order so that construction can commence, till then see Construction process to see the physical development of this board

(added all needed part to part list on google sheets found in 2020 DTX For Oliver page Components and power calculations.)(at time of write this it is on google drive but will be backed up to GitHub once the project is complete )

Also with this daughter board of the ROMS designed. The next step in to continue the ROMS PCB designing so I can then continue with the construction process

OLLYDOTDEV commented 4 years ago

After the sprint review (with me. myself and I), it was noticed that while the proposed design work would and achieve the aim of the user story. Between when I started designing this part of the project found a circuit called shift registers.This would allow me to make LC_Board cheaper, simpler, and even better it will make it easier to produce. Therefore this second sprint I will be focusing on remaking LC_board to use a shift register.

OLLYDOTDEV commented 4 years ago

To start off with the shift registers I will be changing my the IO from #5 and also removing everything else other then the LED from the Schematic. Next, I need to add my level shifter, the level shifter I have picked to use is the STP16C596 in the TSSOP24 SMD package. I have chosen this chip over other mainstream chip such as the 74HC595 due to the need to use 9 pins and a chip like 74HC595 can only control 8 pin so have gone with the STP16C596 it can control 16 pins all at once, yes you are able to just use two 74HC595 but I am trying to keep down the cost as this is an implication that I am keeping in mind so using two 74HC595 would firstly cost more and also would take up more space there for making the STP16C596 a better choice.

but the next issue I found was that STP16C596M doest have a part file for eagle cad so as a fix to this I made my own on https://ms.componentsearchengine.com from this I was able to generate STP16C596M.lbr this can be found in Project-Birdseye-DTX-2020/Schematics/libraries/STP16C596M.lbr

with this, I was now able to import the IC into the LC_Boad.sch

2020-06-17 14_38_27-New Tab

OLLYDOTDEV commented 4 years ago

Ok so with the IO needed for the level shifter sorted out in https://github.com/OLLYDOTDEV/Project-Birdseye-DTX-2020/issues/5#issuecomment-647071016 it connects them to the IC. To do this we can look at Table 3 on the STP16C596M Datasheet

image

From here it can be seen that Power Pins are GND = Ground terminal // Pin 1 SDD = Supply Volage Terminal // Pin 24

From here it can be seen that that for the main input- pins that we care able are

SDI= data serial input // Pin 2 SH_CP =shift clock pulse // Pin 3 ST_CP = storage register clock pulse // Pin 4

Data Pins that would tied to a fixed voltage /OE = Output enable // Pin 21 // PUllED DOWN LOW

image

These pages were used to check the pin hook up to the datasheet as it is better safe than sorry. https://phanderson.com/arduino/stp_596.html https://www.arduino.cc/en/tutorial/ShiftOut

OLLYDOTDEV commented 4 years ago

now time to get back to hooking up the LEDs so they can be controlled. Now knowing that STP16C596 has 16 togglable outputs, at first it was my thought to connect the anode (positive) then bam but yeah no , if only things were that easy. image (Common anode RBG LED)

well they would be it I was using an RGB led with a Common Anode (shown above) but it is cheaper at get a Common cathode RGB LED as (shown below) there for keeping within the implications of this project I am keeping the costs down.

image (Common cathode RGB LED)

To my approach to this is use the fact that the + of current to the point of low charge (eg Ground or the Negative of a battery) So by connecting the output pins from the STP16C596M in the cathodes of the LED's I will be let me control the flow of the current. When a pin for the Shift register is high(5v) then there will be greater (due to STP16C596M running at 5v and the LED at only 3v) electric potential difference there for with no current flowing the LED and in turn, will turn off. Whereas if the pin from the Shift register is set to low then there will be an electric potential difference thought the LED and current will flow and hence the LED will produce light. Sure yes it is backward to how one would normally think to turn on and off of LED but it should work (prototypes of example circuits were used to test the therory behind this) have the control be inverted is no issue due to the fact that code https://github.com/OLLYDOTDEV/Project-Birdseye-DTX-2020/issues/7 will be able to compensate

OLLYDOTDEV commented 4 years ago

image Here the LEDs have been connected to OUT put pins Shift register. I have done as much testing as I can with parts I have on hand put the key to this is yet to be tested. the Key is for the Shift register to be bidirectional so when they are not providing power they hopefully and act as a path to ground. this will be tested one the shipment of parts has arrived still then this sprint is at an end and will need to be reopened once the appropriate components in unavailable to be tested/prototyped

https://github.com/OLLYDOTDEV/Project-Birdseye-DTX-2020/commit/38e38a723ac9d003f8767095b455d9875b63956c