₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,325,017 members, 8,419,959 topics. Date: Thursday, 04 June 2026 at 08:18 AM

Toggle theme

Guassian's Posts

Nairaland ForumGuassian's ProfileGuassian's Posts

1 2 3 4 (of 4 pages)

Science/TechnologyRe: Electronics Circuit Design From Concept To Implementation by guassian: 9:21am On Aug 27, 2015
Feel free to ask any question. There is a saying "ASK STUPID QUESTIONS SO YOU DON'T MAKE STUPID MISTAKE"
Science/TechnologyRe: Electronics Circuit Design From Concept To Implementation by guassian: 9:19am On Aug 27, 2015
lekropasky:
HeLLo Gurus...
I have been reading this thread line-by-line from page 0 to the last page.
I really want to learn how to build circuits as i have zero knowlegde about it.

Can someone recommend some resourses i can use to learn all these-
PIc
Microcontrollers
And everything.....

i dont know how to start, thats my problem, someone should pls tellme how to learn all these..

I am a 100L student of Computer Engineering in a Nigerian University.

Thanks in Advance.
Why dont you want us to know the University you are? Are you not proud of the fact that you are selected among thousands of applicant. Anyway...

there are series of tutorials here on nairaland and other websites. just type the word "Microcontroller", you will get many topics and threads that talks about what you are looking for. one of them is the series that I did on microcontroller and embedded systems which u can start here https://www.nairaland.com/2174624/embedded-systems-future-electronics-computer
Science/TechnologyRe: Embedded System Tutorial For Beginners #include<module1.h> by guassian(op): 12:24am On Jun 07, 2015
Jesuspolice:
I have really been blessed by all these tutorials.
Pls i am a beginner in this...i have learnt the basics of some of these languages like FORTRAN, C++...It looks boring, i just can find how it applies.
moreover can someone send me the link to get Assembly language compiler
Oh! You mean assembly language assembler. You can always get that online or download from 4shared.com or better still i will give u link to MPASM an assembler for PIC MCU. http://dc470.4shared.com/download/bhHLV_KM/MPASM.exe?tsid=20150606-231233-bf5585e4&lgfp=2000

But assembly language in this modern world is outdated. Embedded Systems company are moving c++ makers of microcontrollers are designing the architecture to be "C compiler optimised" meaning you could explore all functions of the MCU using C language.

Take my little advice, continue learning high level language, dont go back to "old school"

Science/TechnologyRe: I Need A Laptop Solar Charger Or Something Like That by guassian: 9:11am On May 27, 2015
You can order one at aliexpress.com
Science/TechnologyRe: EMBEDDED SYSTEMS Tutorial For Beginners:#include <module4.h> Experiments 1 & 2 by guassian(op): 8:32pm On May 18, 2015
JavaPrince1:
Yea thanks. Even my lecturers mavle at what I have been doing with the UNO board. But I dont really need to focus on arduino for my projects. I need to know how to write assembly or C/C++ codes that can directly access the registars of the hardwares I will be programming.
This is impressive. Keep it up bro. Knowing assembly language to access the interbal register of the hardware is not really necessary in this modern day embedded systems. It is synonymous to using command prompt to do some computer configurations. Most of the modern microcontroller are C or C++ compiler optimised, so u can do without assembly.

You can still learn a little about it just to know it but i bet u wont need it so much. My little advice is Concentrate on C and C++.
Science/TechnologyRe: EMBEDDED SYSTEMS Tutorial For Beginners:#include <module4.h> Experiments 1 & 2 by guassian(op): 7:43am On May 18, 2015
Woow, thats a good start. Arduino is open source so u can get a lot of answers to your questions online. You can also get various libraries for various peripherals and that makes code development much more easier for a starter
Science/TechnologyRe: Embedded Systems Tutorial For Beginners:experiment 3( Led Chaser And Rgb Led) by guassian(op): 9:26pm On May 16, 2015
Savotech:
If i get u right, u said i can get 16 million colors from 1 rgb led, how possible is that.
Yea u read me right...

Using Pulse width modulation to vary the brightness of a particular color u get the grey scale of that color. And the amount of color u can get is determined by the bit resolution of the PWM.

For example if a 8 bit PWM is used, that means we can get 2^8 (255) scale per color, let say red. Now using Red Green and Blue simulteneously using 8 bit PWM each, we get 255 x 255 x 255 colors which is in order of about 16 millions.

Hope u understand, if u r not still clear please let me know.
Science/TechnologyRe: EMBEDDED SYSTEMS Tutorial For Beginners:#include <module4.h> Experiments 1 & 2 by guassian(op): 9:10pm On May 16, 2015
JavaPrince1:
Keep up the good work bro.
I found it hard to walk through the tutorials but now I am done doing so.
The thing I had always wanted to do was to be able to write embedded code and test on virtual instrument before flashing my physical circuit with the code.
I want to enroll for an embedded course using MPLAB, Protus and Pickit2 though the price is too high for me to comfortably afford.
I just want to know what to expect from this course I'm about to enroll in.
I want to learn how I can model real life circuits with code so that I will be able to work as an embedded engineer.
This is a very good thing for u to do. Knowledge is power, i dont know the price you want to pay but i know it worth it.

The reason i am doing tutorial here is to put beginners through and to be there to answer any questions that they may have oncerning embedded systems.

The simple truth is that u can learn it without paying money to anybody. You just pay to subscribe to internet and pay your time in studying and pay your ego to ask questions about what u dont know and pay your patience.
ProgrammingRe: Embedded Systems Tutorial For Beginners:experiment 4 (traffic Light System) by guassian(op): 9:02pm On May 16, 2015
harryobas:
From the concurrency options you have enumerated it is clear that the RTOS approach to concurrency is much more cleaner and efficient since it frees the developer from having to worry about application independent functionality such concurrency. While on the issue of RTOS, another question i would like to ask relates to the issue of portability. if a program is written for a particular RTOS can the program be migrated between two different MCUs from different manufacturers both running that particular RTOS without any form of modification?
U see, program portability is one of the problems of Embedded system development. Code written for a PIC microcontroller is not compatible with AVR and the likes. This is the reason why many developer stick to only one or two type of microcontroller when they have mastered d architecture.

The summary of this is that RTOS code cannot be migrated between two MCU of different families or architecture, nothing of such exist as far as i know, I stand to be corrected though.

The solution i have thought of to this is for IEEE to gather various compiler development companies to create one giant compiler that will have a common syntax and resource management across all various types of microcontroller, so that a syntax written for a MCU will work for the other.
ProgrammingRe: Embedded Systems Tutorial For Beginners:experiment 4 (traffic Light System) by guassian(op): 4:25pm On May 16, 2015
harryobas:
@Guassian
pls one quick question about concurrency in embedded systems software in general. Looking at your source code, it is clear that you have adopted a sequential approach to data acquisition by reading each pin one after the other as illustrated in the start section of you code. Just wanted to know how you would approach a scenario where input changes are happening concurrently. In this kind of situation, the sequential approach to data acquisition simply does not work and since there is no kernel to provide units of concurrency such as threads/tasks, i just think it would be quite a hideous task for the programmer to provision code for concurrency in addition to normal application code.
Concurrency can be achieved by using a real time operating system RTOS which has the kernel for effective management of IO port. RTOS is efficient and effective in MCU that has high processing power, RAM, ROM etc. RTOS is very complex method of programming but something similar to that is achieved in smaller MCU using a time division multiplexing in which the cpu does the job(s) fast enough to detect any input change in multiple input system and produce information in multiple output system.

In other words, Using a multiple input system requires the cpu to be fast enough to give attention to all the inputs. For example, the cpu can poll data from a push button input system with a period of 10 microseconds. This poll rate is even enough to detect up to 10000 buttons.

So concurrency can be achieved to a large extent using speed MCU. And also depends on how the developer can effectively manage CPU resource time and sharing.
ProgrammingRe: Embedded Systems Tutorial For Beginners:experiment 4 (traffic Light System) by guassian(op): 12:54pm On May 16, 2015
About using interrupt...

Savotech:
I have read about interrupts.they r little bit complex for beginner and are used only when the application is time bound or does so many work. I have read many PIC programming book and what they used for reading input button is not an interrupt except except 4x4 keypad which they used portB interrupt. So i think guassian is on the right track. Another thing i notice is that the PIC12f683 he used does not have an external interrupt function.
Savotech has said it all.
ProgrammingRe: Embedded Systems Tutorial For Beginners:experiment 4 (traffic Light System) by guassian(op): 12:52pm On May 16, 2015
Woow... I am impressed. You guys have said it all. Actually, sometimes I use GOTO and while interchangeable when working with simple programs like this traffic light but when working with large program I use WHILE for endless loop and it makes it easily edittable if i decide to add some conditional statement to it.

Sincerely, i decided to use the GOTO just for a beginner out there to easily understand. GOTO is more easy to process logically for a layman than WHILE. but in the actual sense the do the same thing as to provide an endless loop for programs.

Using GOTO will require the developer to create a unique name label which may be too cumbersome if he has to create multiple of it but using WHILE, same while(1); is used anywhere in the program.
Science/TechnologyEmbedded Systems Tutorial For Beginners:experiment 5 Intro To 7 Segment Displays by guassian(op): 8:40am On Apr 29, 2015
EXPERIMENT 5: INTRODUCTION TO 7 SEGMENT DISPLAY
You are welcome to another episode of my Embedded systems tutorials for beginners. You can get previous tutorials from this link…
https://www.nairaland.com/2255112/embedded-systems-tutorial-beginners-experiment and if you are new to this series of tutorial you can start from the beginning… https://www.nairaland.com/2175195/embedded-systems-future-electronics-computer


Tools needed:
Software: Proteus 8 to simulate the software on virtual hardware, CCS compiler version 4.0 and above to write and compile programs, pickit2 IDE to burn your compiled code into your MCU
Hardware: Bread board, common cathode 7 segment display, pic16f88, 7 segment display, pickit2 programmer, USB cable and power bank or USB charger to create 5v supply. All the hardware components can be gotten from a reputable Electronics Component supplying company http://hub360.com.ng/shop-2/hub360-pic-starter-kit/

Overview:
The fifth experiment in this series of tutorial is to learn about seven segment displays which are widely used as output display in embedded systems applications.
A seven-segment display (SSD), is a form of electronic display device for displaying decimal numerals that is an alternative to the more complex dot matrix displays. Dot matrix display are used for alphanumeric and graphical characters Seven-segment displays are widely used in digital clocks, electronic meters, basic calculators, and other electronic devices that display numerical information. Comparing the dat matrix display and 7 segment display below we will see that to display figure “1” in dot matrix requires 11 dots while in 7 segment display requires 2 segments.

FULL ARTICLE WHICH CONTAINS DIAGRAMS IMAGES AND TABLE IS ATTACHED TO THIS POST


With the 7 segment displays you can display any number or some alphabets that your heart desires. At first controlling a 7 segment display seems quite complex but it quickly becomes clear when you are familiar with it and you understand its working principles.
A seven segment display, as its name indicates, is composed of seven elements. Individually on or off, they can be combined to produce simplified representations of the Arabic numerals. The seven segments are arranged as a rectangle of two vertical segments on each side with one horizontal segment on the top, middle, and bottom. Additionally, the seventh segment bisects the rectangle horizontally. There are also fourteen-segment displays and sixteen-segment displays for full alphanumerics display. For the sake of this tutorials for beginner, we are going to limit ourselves to 7 segment.
The seven segments is universally labeled and this standard is used world wide. It is labeled alphabetically clock-wisely as in the diagram below:

CHECK THE THE END OF THE POST FOR A DOCUMENT FILE



TYPES OF 7 SEGMENT DISPLAY:
There are two types of LED 7-segment displays with respect to their logical operation and circuit connection: common cathode (CC) and common anode (CA). The difference between the two displays is the common cathode has all the cathodes of the 7-segment LED connected directly together and the common anode has all the anodes of the 7-segments connected together. Shown below is a common anode seven segment.


As shown above all the anode segments are connected together. When working with a CA seven segment display, power must be applied externally to the anode connection that is common to all the segments. Then by applying a ground to a particular segment connection (a-g), the appropriate segment will light up. An additional resistor must be added to the circuit to limit the amount of current flowing through each LED segment.


A common cathode seven segment is different from a common anode segment in that the cathodes of all the LEDs are connected together. For the use of this seven segment the common cathode connection must be grounded and power must be applied to appropriate segment in order to illuminate that segment.


WRITING THE PROGRAM
Using a microcontroller to control a SSD requires at least 7 pins, so PIC12f683 cannot be used because it only has 6 ports except a BCD to & segment decoder IC is going to be used with it, but that makes the circuit more complex. So we use PIC16F88 that has enough IO pins (16).
We are going to control the port altogether. We are going to be putting some values into the port which will enable the SSD to form the figure pattern that we want. Below is the table to that shows the pattern logic and the 8-bit data combination. The segments are arranged g-a because we want to connect a-g to port b0-b6 respectively and you know the least significant bit, bit0 starts from the right.

GET THE FULL TEXT ARTICLE INCLUDING THE SOURCE CODE, HEX FILE AND PROTEUS FROM THE FILES ATTACHED TO THIS POST

Science/TechnologyEmbedded Systems Tutorial For Beginners:experiment 5 Intro To 7 Segment Displays by guassian(op): 8:26am On Apr 29, 2015
EXPERIMENT 5: INTRODUCTION TO 7 SEGMENT DISPLAY
You are welcome to another episode of my Embedded systems tutorials for beginners. You can get previous tutorials from this link…
https://www.nairaland.com/2255112/embedded-systems-tutorial-beginners-experiment and if you are new to this series of tutorial you can start from the beginning… https://www.nairaland.com/2175195/embedded-systems-future-electronics-computer


Tools needed:
Software: Proteus 8 to simulate the software on virtual hardware, CCS compiler version 4.0 and above to write and compile programs, pickit2 IDE to burn your compiled code into your MCU
Hardware: Bread board, common cathode 7 segment display, pic16f88, 7 segment display, pickit2 programmer, USB cable and power bank or USB charger to create 5v supply. All the hardware components can be gotten from a reputable Electronics Component supplying company http://hub360.com.ng/shop-2/hub360-pic-starter-kit/

Overview:
The fifth experiment in this series of tutorial is to learn about seven segment displays which are widely used as output display in embedded systems applications.
A seven-segment display (SSD), is a form of electronic display device for displaying decimal numerals that is an alternative to the more complex dot matrix displays. Dot matrix display are used for alphanumeric and graphical characters Seven-segment displays are widely used in digital clocks, electronic meters, basic calculators, and other electronic devices that display numerical information. Comparing the dat matrix display and 7 segment display below we will see that to display figure “1” in dot matrix requires 11 dots while in 7 segment display requires 2 segments.

FULL ARTICLE WHICH CONTAINS DIAGRAMS IMAGES AND TABLE IS ATTACHED TO THIS POST


With the 7 segment displays you can display any number or some alphabets that your heart desires. At first controlling a 7 segment display seems quite complex but it quickly becomes clear when you are familiar with it and you understand its working principles.
A seven segment display, as its name indicates, is composed of seven elements. Individually on or off, they can be combined to produce simplified representations of the Arabic numerals. The seven segments are arranged as a rectangle of two vertical segments on each side with one horizontal segment on the top, middle, and bottom. Additionally, the seventh segment bisects the rectangle horizontally. There are also fourteen-segment displays and sixteen-segment displays for full alphanumerics display. For the sake of this tutorials for beginner, we are going to limit ourselves to 7 segment.
The seven segments is universally labeled and this standard is used world wide. It is labeled alphabetically clock-wisely as in the diagram below:

CHECK THE THE END OF THE POST FOR A DOCUMENT FILE



TYPES OF 7 SEGMENT DISPLAY:
There are two types of LED 7-segment displays with respect to their logical operation and circuit connection: common cathode (CC) and common anode (CA). The difference between the two displays is the common cathode has all the cathodes of the 7-segment LED connected directly together and the common anode has all the anodes of the 7-segments connected together. Shown below is a common anode seven segment.


As shown above all the anode segments are connected together. When working with a CA seven segment display, power must be applied externally to the anode connection that is common to all the segments. Then by applying a ground to a particular segment connection (a-g), the appropriate segment will light up. An additional resistor must be added to the circuit to limit the amount of current flowing through each LED segment.


A common cathode seven segment is different from a common anode segment in that the cathodes of all the LEDs are connected together. For the use of this seven segment the common cathode connection must be grounded and power must be applied to appropriate segment in order to illuminate that segment.


WRITING THE PROGRAM
Using a microcontroller to control a SSD requires at least 7 pins, so PIC12f683 cannot be used because it only has 6 ports except a BCD to & segment decoder IC is going to be used with it, but that makes the circuit more complex. So we use PIC16F88 that has enough IO pins (16).
We are going to control the port altogether. We are going to be putting some values into the port which will enable the SSD to form the figure pattern that we want. Below is the table to that shows the pattern logic and the 8-bit data combination. The segments are arranged g-a because we want to connect a-g to port b0-b6 respectively and you know the least significant bit, bit0 starts from the right.

GET THE FULL TEXT ARTICLE INCLUDING THE SOURCE CODE, HEX FILE AND PROTEUS FROM THE FILES ATTACHED TO THIS POST

ProgrammingRe: Help On Embedded by guassian: 10:28am On Apr 23, 2015
kshow702:
I'm olusola by name,any embedded programmer(microcontroller) in d house.dah can teach me,shld contact me on dis nos 0701119521....very urgent
Good, you can get yourself started with these series of tutorial from here https://www.nairaland.com/2175195/embedded-systems-future-electronics-computer
Science/TechnologyRe: All Sim Card Have Names,check Yours Here by guassian: 10:13pm On Apr 18, 2015
okoocheche:
hello guys, anybody with the price of solar energy should help me out. What's up me on 07068530603, tanks
Haba, why the change of topic. Why not open a new thread for that. Those that have the info might not see it here.
Science/TechnologyRe: All Sim Card Have Names,check Yours Here by guassian: 9:49am On Apr 15, 2015
ANIEXTY:
(Please forgive me, because I dont know the right place to post this please)
~~THE MAGIC OF SCIENCE~~
Do you know that every SIM card has a namehuh
Yes! That your SIM card has a name. Now, try the steps below to know the name of your SIM card. When you confirm the MAGIC, please don't forget to SHARE.
Comment below to see the MAGIC by following the steps below :
Step1: from your phone number, take out the last (3)three digits. E.g if your number is 08035139836, take out "836" only.
Step2: In the comment box, type @*[last 3 digit phone number:0]... i.e , @*[836:0].
Step3: Remove the * sign, then press send in the comment box and thank me later when you see the MAGIC. Mine is "Joe"
check urs, and let us know.
Mod. Abeg help me move it to the right place thanks
You are not communicating at all.
Which magic? Science is not a magic.
name? Whose name.
Which comment box?
And what is the purpose of the whole thing.

If u really want people to learn from you, please try not to leave them more confused.
Science/TechnologyRe: Embedded Systems Tutorial For Beginners:experiment 3( Led Chaser And Rgb Led) by guassian(op): 8:09am On Apr 14, 2015
The next experiment which is a traffic light system is posted here https://www.nairaland.com/2255112/embedded-systems-tutorial-beginners-experiment#32700514
ProgrammingEmbedded Systems Tutorial For Beginners:experiment 4 (traffic Light System) by guassian(op): 8:05am On Apr 14, 2015
You can get previous tutorials from this link… https://www.nairaland.com/2244503/embedded-systems-tutorial-beginners-experiment
and if you are new to this series tutorial you can start from the beginning… https://www.nairaland.com/2175195/embedded-systems-future-electronics-computer



EXPERIMENT 4: TRAFFIC LIGHT SYSTEM
Tools needed:
Software: Proteus 8 to simulate the software on virtual hardware, CCS compiler version 4.0 and above to write and compile programs, pickit2 IDE to burn your compiled code into your MCU
Hardware: Bread board, Red Yellow and Green LED, jumper wire, pic12f683, 3 way switch, pickit2 programmer, USB cable and power bank or USB charger to create 5v supply. All the hardware components can be gotten from a reputable Electronics Component supplying company http://hub360.com.ng/shop-2/hub360-pic-starter-kit/

Overview: The fourth experiment for this series of tutorial is the Traffic light system. We are now moving from simple projects to an intermediate and more tasking one.
Traffic light system is a system used to control movements of vehicles and human on the road. It is always installed at strategic locations where vehicles coming from a particular lane or road intersect another. Traffic lights are also installed to location where pedestrians wants to cross the road, especially little school children. As we all know, traffic light has only three color signs; red which represents STOP, yellow which represents READY and green which represents GO. Modern traffic light now comes with countdown timer which tells the motorist the time left to GO or STOP. Modern traffic light systems are very complex system and sophisticated, some involves artificial intelligence which can make fast decision by itself on which lane to PASS and which to STOP at general and specific conditions, and respond to priority change and override.
There are two major categories of traffic light system. The open loop traffic system and the closed loop traffic system. Open loop is when the “go time” and “stop time” is fixed and the time allocated is not in any way determined by the weight of traffic. Closed loop traffic system is one that the time allocated is not fixed but is determined by the weight of traffic. Modern traffic light system is closed loop type; it is either controlled by an artificial intelligence robot or a traffic warden or from a control room in a remote location via wireless technology.
For the sake of this tutorial for beginners we are going to restrict ourselves to an open loop two ways traffic system without counter just for simplicity then later we can do a closed loop with countdown timer when we have reached intermediate or professional level. However even in this level we can modify our code to do a semi-closed loop; how do I mean… a semi-closed loop system in this context is a system where by different portion of code will be created to cater for heavy traffic, intermediate and light traffic, these code can be selected by using a switch. More explanation will be made later in this tutorial

OPEN LOOP TRAFFIC LIGHT SYSTEM: In a two way traffic light system, when the light stops a lane, it passes the other lane and vice versa. So what we actually need is one circuit which will control the two traffic light system. The red light of a lane will be connected to the green light of the second and vice versa, both yellow lights are connected together. To achieve this all we need is to send 3-bit number which will represent the 3 light to the port of the microcontroller and to delay the output for some few seconds. We send “1” to the port which represents RED or STOP, we delay for the number of times we want then send “3” which will still activate the RED light and also switch on the YELLOW for READY and we delay it for the time we want. Then we send “4” which deactivates both red and yellow light and switch on the GREEN for a GO and we also delay the output, then the program moves to the top. The state table below explains more.

FULL TEXT OF THIS ARTICLE IS IN THE DOC FILE ATTACHED TO THIS POST

CLOSED-LOOP TRAFFIC LIGHT SYSTEM:
As we have discussed above, a closed-loop system is one that has a feed back to control the time allocated to a particular lane of the traffic. The feedback system can be a human e.g. a traffic warden or it can be automated i.e. sensors are installed at strategic locations to determine weight of traffic and allocate time as set by the designer of the system and specification given. In this tutorial, we will be doing what I personally called a semi closed-loop system. It will have 3 way switch for the user to switch between heavy, intermediate and light traffic conditions. The reason why it is not a full closed loop system is that it has only 3 conditions which in the real world, millions of condition exist.
Even with these 3 conditions a good project can still be done. Take for example at Abule-egba traffic light junction: early in the morning, the vehicles coming from Sango to Iyana-ipaja and Agege is much thereby making the traffic heavy but the vehicles coming from Iyanapa going to sango is few, in such case, we can assign 60 seconds “GO” and 20 seconds “STOP” to where there is heavy traffic which will amount to 20 seconds GO and 60 seconds STOP to the other side. In the afternoon the traffic is intermediate so we can assign 20 seconds to both sides. Then the evening is a reverse effect of the morning so we assign more traffic to vehicles going to sango. But remember that there are exceptional cases which is not included in these 3 sets of conditions, and that is what makes it a semi-closed-loop system.
In writing the program, we will be using a new syntax which is used to read the logic state on a switch, and along side, we will be suing “if” conditional statement. You can pick up a C programming ebook for more understanding of conditional statements.
There are so many approach we can use to write this code and get the same result, using functions, switch statements etc but the approach I will like to use for a beginner is the if-goto approach. Switch 1 will be for heavy “more traffic at lane 1”, switch 2 will be for “balance” switch 3 will be for “more heavy traffic at lane 2”. So the algorithm will be as follows:
1. Start
2. Initialize ports and internal registers and delays.
3. Read switch 1 if logic(1) is detected goto 6 else continue with 4.
4. Read switch 2 if logic(1) is detected goto 7 else continue with 4.
5. Read switch 3 if logic(1) is detected goto 8 else goto 3.
6. Do “heavy traffic” and goto 3.
7. Do “intermediate” and goto 3.
8. Do “light traffic” and goto 3.
9. end
CIRCUIT DIAGRAM...

FULL TEXT OF THIS ARTICLE IS IN THE DOC FILE ATTACHED TO THIS POST

THE SOURCE CODE, PROTEUS SIMULATION AND HEX FILE IS IN A RAR FILE ATTACHED TO THIS POST


WATCH OUT FOR THE NEXT TUTORIAL

Science/TechnologyEmbedded Systems Tutorial For Beginners:experiment 4 (traffic Light System) by guassian(op): 7:55am On Apr 14, 2015
You can get previous tutorials from this link… https://www.nairaland.com/2244503/embedded-systems-tutorial-beginners-experiment
and if you are new to this series tutorial you can start from the beginning… https://www.nairaland.com/2175195/embedded-systems-future-electronics-computer



EXPERIMENT 4: TRAFFIC LIGHT SYSTEM
Tools needed:
Software: Proteus 8 to simulate the software on virtual hardware, CCS compiler version 4.0 and above to write and compile programs, pickit2 IDE to burn your compiled code into your MCU
Hardware: Bread board, Red Yellow and Green LED, jumper wire, pic12f683, 3 way switch, pickit2 programmer, USB cable and power bank or USB charger to create 5v supply. All the hardware components can be gotten from a reputable Electronics Component supplying company http://hub360.com.ng/shop-2/hub360-pic-starter-kit/

Overview: The fourth experiment for this series of tutorial is the Traffic light system. We are now moving from simple projects to an intermediate and more tasking one.
Traffic light system is a system used to control movements of vehicles and human on the road. It is always installed at strategic locations where vehicles coming from a particular lane or road intersect another. Traffic lights are also installed to location where pedestrians wants to cross the road, especially little school children. As we all know, traffic light has only three color signs; red which represents STOP, yellow which represents READY and green which represents GO. Modern traffic light now comes with countdown timer which tells the motorist the time left to GO or STOP. Modern traffic light systems are very complex system and sophisticated, some involves artificial intelligence which can make fast decision by itself on which lane to PASS and which to STOP at general and specific conditions, and respond to priority change and override.
There are two major categories of traffic light system. The open loop traffic system and the closed loop traffic system. Open loop is when the “go time” and “stop time” is fixed and the time allocated is not in any way determined by the weight of traffic. Closed loop traffic system is one that the time allocated is not fixed but is determined by the weight of traffic. Modern traffic light system is closed loop type; it is either controlled by an artificial intelligence robot or a traffic warden or from a control room in a remote location via wireless technology.
For the sake of this tutorial for beginners we are going to restrict ourselves to an open loop two ways traffic system without counter just for simplicity then later we can do a closed loop with countdown timer when we have reached intermediate or professional level. However even in this level we can modify our code to do a semi-closed loop; how do I mean… a semi-closed loop system in this context is a system where by different portion of code will be created to cater for heavy traffic, intermediate and light traffic, these code can be selected by using a switch. More explanation will be made later in this tutorial

[b]OPEN LOOP TRAFFIC LIGHT SYSTEM: [/b]In a two way traffic light system, when the light stops a lane, it passes the other lane and vice versa. So what we actually need is one circuit which will control the two traffic light system. The red light of a lane will be connected to the green light of the second and vice versa, both yellow lights are connected together. To achieve this all we need is to send 3-bit number which will represent the 3 light to the port of the microcontroller and to delay the output for some few seconds. We send “1” to the port which represents RED or STOP, we delay for the number of times we want then send “3” which will still activate the RED light and also switch on the YELLOW for READY and we delay it for the time we want. Then we send “4” which deactivates both red and yellow light and switch on the GREEN for a GO and we also delay the output, then the program moves to the top. The state table below explains more.

FULL TEXT OF THIS ARTICLE IS IN THE DOC FILE ATTACHED TO THIS POST

CLOSED-LOOP TRAFFIC LIGHT SYSTEM:
As we have discussed above, a closed-loop system is one that has a feed back to control the time allocated to a particular lane of the traffic. The feedback system can be a human e.g. a traffic warden or it can be automated i.e. sensors are installed at strategic locations to determine weight of traffic and allocate time as set by the designer of the system and specification given. In this tutorial, we will be doing what I personally called a semi closed-loop system. It will have 3 way switch for the user to switch between heavy, intermediate and light traffic conditions. The reason why it is not a full closed loop system is that it has only 3 conditions which in the real world, millions of condition exist.
Even with these 3 conditions a good project can still be done. Take for example at Abule-egba traffic light junction: early in the morning, the vehicles coming from Sango to Iyana-ipaja and Agege is much thereby making the traffic heavy but the vehicles coming from Iyanapa going to sango is few, in such case, we can assign 60 seconds “GO” and 20 seconds “STOP” to where there is heavy traffic which will amount to 20 seconds GO and 60 seconds STOP to the other side. In the afternoon the traffic is intermediate so we can assign 20 seconds to both sides. Then the evening is a reverse effect of the morning so we assign more traffic to vehicles going to sango. But remember that there are exceptional cases which is not included in these 3 sets of conditions, and that is what makes it a semi-closed-loop system.
In writing the program, we will be using a new syntax which is used to read the logic state on a switch, and along side, we will be suing “if” conditional statement. You can pick up a C programming ebook for more understanding of conditional statements.
There are so many approach we can use to write this code and get the same result, using functions, switch statements etc but the approach I will like to use for a beginner is the if-goto approach. Switch 1 will be for heavy “more traffic at lane 1”, switch 2 will be for “balance” switch 3 will be for “more heavy traffic at lane 2”. So the algorithm will be as follows:
1. Start
2. Initialize ports and internal registers and delays.
3. Read switch 1 if logic(1) is detected goto 6 else continue with 4.
4. Read switch 2 if logic(1) is detected goto 7 else continue with 4.
5. Read switch 3 if logic(1) is detected goto 8 else goto 3.
6. Do “heavy traffic” and goto 3.
7. Do “intermediate” and goto 3.
8. Do “light traffic” and goto 3.
9. end
CIRCUIT DIAGRAM...

FULL TEXT OF THIS ARTICLE IS IN THE DOC FILE ATTACHED TO THIS POST

THE SOURCE CODE, PROTEUS SIMULATION AND HEX FILE IS IN A RAR FILE ATTACHED TO THIS POST


WATCH OUT FOR THE NEXT TUTORIAL

Science/TechnologyRe: Embedded Systems Tutorial For Beginners:experiment 3( Led Chaser And Rgb Led) by guassian(op): 10:11pm On Apr 09, 2015
https://www.nairaland.com/2219715/embedded-systems-tutorial-beginners-include

This is the link for the previous tutorials.

If you dont understand anything, those hesitate to ask questions
Science/TechnologyRe: EMBEDDED SYSTEMS Tutorial For Beginners:#include <module4.h> Experiments 1 & 2 by guassian(op): 8:09pm On Apr 08, 2015
Science/TechnologyEmbedded Systems Tutorial For Beginners:experiment 3( Led Chaser And Rgb Led) by guassian(op): 7:03pm On Apr 08, 2015
EXPERIMENT 3: MULTIPLE OUTPUTS, LED CHASER AND RGB LED

Tools needed:
Software: Proteus 8 to simulate the software on virtual hardware, CCS compiler version 4.0 and above to write and compile programs, pickit2 IDE to burn your compiled code into your MCU
Hardware: Bread board, RGB LED, jumper wire, pic12f683, pic16f88, BC547 NPN transistor pickit2 programmer, USB cable and power bank or USB charger to create 5v supply. You can get the hardware from a reputable Electronics Component supplying company http://hub360.com.ng/shop-2/hub360-pic-starter-kit/


Overview: The third experiment for this series of tutorial is to learn how to use the microcontroller to control multiple outputs which can then be applied in designing a LED chaser, control of multiple relays, RGB Leds etc. We can control the output port of a microcontroller individually as a pin or collectively as a port(group of pins). Both has advantages and disadvantage. Controlling the output individually as a pin is useful if other output pins in a port is not to be affected or changed. We can only control a pin as a BIT (Binary Digit) i.e. we can send a high and low to the pin or true and false or 1 and 0 which represents 5volts and 0volts respectively.

Controlling as a bit is tedious if we want to change the logic state of a while a whole port, it will require changing the state of the pins one by one which makes the processor takes more time to do the job and it also takes more code space, and the program will become much more complex to alter some values.
However, controlling the output as a port saves time and code space. It output data to the port as a BYTE (8 bit) i. e it doesn’t makes use of true and false only but you can make use of other number representation to control the output. Most low-end and mid-range microcontrollers are 8-bit (it has only 8 wires called bus to pass information internally), so the output port too is 8-bit wide. This implies that a port can only control 8 pins, so a number from 0 to 255 (decimal) can be used to control the whole port. Other number representation is binary which is 00000000 to 11111111 or hexadecimal from 00 to FF. Those are the common and most widely used number representation as far as embedded programming is concerned. Take for example:
To control the pins of port A of a PIC16f88 microcontroller individually we use the CCS C Compiler syntax:
Output_high(pin_a4); // sends logic 1 to the 5th output of port A. numbering starts from 0 to 7
Output_low(pin_a1); // sends logic 0 to the 2nd pin of port A.
To control the whole port A at once, we use the syntax:
Output_a(0b00010000); // set the 5th output of port A as logic 1 and other pins in the port as 0 using binary number system
Output_b(0X55); // the argument is a number in hexadecimal which when converted to binary gives 01010101, turns pin A0,A2,A4,A6 high and others low. The number can also be represented in binary or decimal as the program developer wishes


LED CHASER: have you ever wonder how christmass light and decoration light are done whereby all the light seems to be flashing in a particular sequence and some will be as if they are chasing themselves? Its just simple programming and nothing more. Physically we can see many lights even up to hunderds but to tell you the fact most of these decoration lights are just 4 channels i.e it has only 4 outputs that are duplicated. Eg a 100 light decoration that has 4 outputs that are duplicated 25 times. We are going to create a 4 output 12 LED light chaser. The 4 outputs will be duplicated 3 time i.e led 5 will be connected to led 1, led 6 will be connected to led 2 and so on. Hardware speaking, theses connections can be in parallel or in series. If 220Vac is to be used directly to power the LEDs and the LEDs are much lets say 200, then they should be connected series and a resistor should be connected also and a triac opt coupler should be used. For 200 LEDs using 4 channels, there will be 50 LEDs per channel and connecting them in series considering average of 3volts led breakdown voltage gives 150volts which is ok for a typical Nigerian electricity flunctuation or brownout. A resistor is connected in series to the LEDs to dissipate the excess power when the input voltage is more than 150volts. The leds can be a single color or multicolor depending on the choice of the designer. The resistor value can be calculated by using kirchoffs law(check internet or books given in previous tutorials for (LED resistor head voltage calculation).
How ever, if low voltage is used, then the LEDs may be connected in parallel and what we might just need is 5volts DC power and a transistor to switch. When connecting LEDs in parallel, they should be of the same color because different color of LEDs has different forward voltage. The series and parallel circuit is given below.
THE REST OF THE ARTICLE IS IN THE DOC FILE ATTACHED TO THIS POST.


THE RGB LED:
Colored displays are formed by combining one or more of the three primary colors which is Red Green and Blue. Let me take you back to fine art in our primary school and junior secondary school days and light spectrum in the senior secondary school physics. We were taught that combination of primary colors forms secondary colors for example, red + blue = purple green + red = yellow etc. little did we know that we are going to need that knowledge even in electronics to create display light for decorations, indications and graphic displays. A standard TV color screen displays about 16 million colors and it will surprise you to know that all these 16 million are derived from 3 primary colors Red Green and Blue.

There are various colors of LED commonly available which are red, blue, green, yellow, white. Other colors can be derived by combining two or more led colors or better still using RGB LED. RGB LED is a 3-in-1 combination on Red blue and Green LED in one package. It usually has 4 pins which one is for each LED and the forth is for common. It can be a common anode or a common cathode. Common anode in the sense that the negative terminal of all the leds comes out separately and the positive terminal of all is internally connected together and comes out as one, and the common cathode is vise-versa.

To create different colors we have to switch on some leds individually or collectively according to the above color circle. We can create just only 7 colors by switching on and off the leds but more colors can be created by varying the brightness of these colors. For the sake of the beginners, we r going to restrict ourselves to this 7 colors until we start talking about pulse width modulation techniques which is use to create variable led brightness.

THE REST OF THE ARTICLE IS IN THE DOC FILE GIVEN AT THE END OF THIS POST WHICH CONTAINS IMAGES TO HELP YOU UNDERSTAND BETTER


THE SOURCE FILE, HEX FILE AND PROTEUS FILE OF THIS EXPERIMENT IS ATTACHED TO THIS POST.

Science/TechnologyRe: EMBEDDED SYSTEMS Tutorial For Beginners:#include <module4.h> Experiments 1 & 2 by guassian(op): 4:12pm On Apr 07, 2015
EXPERIMENT 2: POWER-UP DELAY/ POWER ON ALARM
Overview: the second experiment for this series of tutorial is the power-up delay which can also be modified for another purpose which is the power ON alarm also known as “Nepa buzzer”. The function of a power-up delay system is to create a delay for your device or appliance when power is restored. Why do you need to create a delay for you device to receive power? This is to make sure that the power is clean before your sensitive device taps from the power. When PHCN just restore power or you just switch ON your generator, there are many appliances that taps power at the same time and thereby creates a voltage transient which causes power surge or power sag etc that makes the power not to be clean at that point in time until some few seconds when everything is stable.
However, sensitive devices especially medical equipment can get damaged when they get such unclean power so the delay system is needed to ensure that the power is the power is stable before connecting to it. Modern surge protector and voltage stabilizers have this function. The reason why it is essential to connect a fridge or freezer to a stabilizer and enable the delay is that when there is a power outage, the gas tends to return to the compressor. So power should not be restored immediately but be left for some minutes before connecting. A refrigerator, AC or fan uses motors which needs starting current which is about 4 times the running current, and there are times when you are using a generator to power two refrigerators and probably a big typhoon fan also, all tries to start at the same time when you change over thereby causing is a power sag or the generator circuit breaker trips off. This is because the two refrigerators and fan draws 4 times their power at the start so a delay circuit is needed for one of the fridge and the fan so as to allow one to startup and allow the power to be stable before the others start. The power up delay system is created by using a time delay relay, the time delay is easily created by a Microcontroller and can be increased and decreased easily without changing the hardware of the circuit.
As for the power on alarm, there are times you will need an audible alarm to know when mains or PHCN power is restored especially when you are using generator. This alarm is expected to sound continuously for some seconds and then stops until another power failure and restoration before it sounds again.


Continued in the doc file attached to this post


The source code, hex file and Proteus simulation file is also attached to this post

Science/TechnologyRe: EMBEDDED SYSTEMS Tutorial For Beginners:#include <module4.h> Experiments 1 & 2 by guassian(op): 2:27am On Apr 06, 2015
Davidbanky:
I am interested, hopefully I can present one of these for approval in my project ...
yea sure! you are free to do that...
Science/TechnologyRe: EMBEDDED SYSTEMS Tutorial:#include <module3.h>software And Hardware Tool Needed by guassian(op): 9:19am On Mar 28, 2015
Ok, Good. Probably when i finish the tutorial for beginners cos i want to create an avenue for questions.
Science/TechnologyRe: EMBEDDED SYSTEMS Tutorial For Beginners:#include <module4.h> Experiments 1 & 2 by guassian(op): 7:36am On Mar 27, 2015
Don't hesitate to ask questions if you have.
Science/TechnologyRe: EMBEDDED SYSTEMS Tutorial:#include <module3.h>software And Hardware Tool Needed by guassian(op): 7:29am On Mar 27, 2015
Science/TechnologyRe: EMBEDDED SYSTEMS Tutorial For Beginners:#include <module4.h> Experiments 1 & 2 by guassian(op): 7:24am On Mar 27, 2015
More pictures on the implementation

1 2 3 4 (of 4 pages)