Electrikitty Light Controller is a module for electric car. It is required to control LED’s lights which are being used for electric car. Potentially, relays are being used to switch ON/OFF the lights and circuits which use much more power as compare to LED’s? Usually LED’s consumes round about 20mA current but when we compare this to relays which typically consumes 120mA, it makes sense to replace the relays. More over to apply the logics on switching we have to go with mechanical solution which is very hard to install and maintain. We are going to replace the potential system with microcontroller base logic controller shown in below figure
Figure 1: Electrikitty Light Controller
In above picture there push buttons that works as input and then indicators that are being used as output and these two entities are linked via software which is very easy to modify. The new system is independent to the rules or legislations. They just know which inputs need to connect with which outputs. For example, we can say that switch 1 need to connect with output 5 and 7 or switch 3 with output 3 etc. These controllers are going to be reconfigurable so that later on if we need to change the inputs and outputs we can easily do it from software using implemented routine. But using relays, change tends to a lot of work and most of time it results to replacement of whole system.
Digital solutions are usually divided into two parts, hardware and software. There is need for trade of between these two entities. Software is more flexible as compare to the hardware as most of time it deals with logic design while hardware is something physical entity which is not easy to change all the time. Hardware change has large impact to product as compare to the software. It’s easy to modify the software in less time as compare to the hardware. Digital solutions are usually divided into two parts, hardware and software. There is need for trade of between these two entities. Software is more flexible as compare to the hardware as most of time it deals with logic design while hardware is something physical entity which is not easy to change all the time. Hardware change has large impact to product as compare to the software. It’s easy to modify the software in less time as compare to the hardware.
It is a good decision to use less pins microcontroller by separating the inputs and outputs into two parts. We can deal the input and outputs separately using two microcontrollers. It will be easy to test each part and maintain in future. System will be divided into two parts, input and output. We can develop the input and output system as two components which need to connect later on. Potentially, PIC 28 pin microcontroller with MCU 18 family is being used to develop the controller. These are new generation microcontrollers which are very tolerant to external interfaces as ports etc. Moreover, our development cost will also be reduced as in later on if we encounter any problem in microcontroller, we have to replace input or output component only which is non-functional but in case of larger number of pins microcontroller we have to replace a bigger one and we have to bear more price. So, system is being divided into two parts.
Input controller will accept inputs from user and output controller will be used as output port for external world. Input controller will forward user input to the output controller which will modify the system output.
Software is a brain which derive the hardware. It processes the data and produces output for external world that can be any external hardware or software system. Every system takes at least one input and produces at least one output. Our potential system takes input and produces output on base of output logic which is the main part of system under development. Here is a process transitions for first level system division as
Figure 2: Process Transition Diagram
The use case diagram describes the system from user usage perspective that how the system is going to be invoked by user which can be person or external system entity.
Figure 3: Use Case Diagram
In above use case diagram there are actually two sub systems for logic controller, input controller and output controller. There stepwise illustration can be described as
For above figure the inputs are number of switches on input controller which user can press in our case of ‘Electrikitty Light Controller’. As a result, the result be calculated on the base of logic controller and output will be set for output controller. Output logic controller is the processing unit for logic controller.
We have divided our system into two parts, inputs and outputs. So, there is need to maintain communication between them. Input controller need to send information to output controller and we need to decide that how they are going to communicate each other. We have tow following options a
In case of parallel communication we need to send information at a time just like a bust to the output controller. We need to handle 20 inputs and 20 outputs. So, for each input we have to send a unique identifier to the output controller so, that it can be decided that which pin need to set against a particular input. So, the maximum number which we need to transmit is 19 if we start from 0. We need at least 5 bits to transmit 0 – 19 unique identifier. Moreover, we also need few more bits to confirm that data has been transmitted successfully or not. It will occupy at least 6 pins which is much larger size in numbers as compare to the total number of pins available to use. We are also not sure if any one of them gets loose or disconnected. There are high chances of misinterpretation if any single data line gets failed. It is quite good if we go with serial communication which uses single data line for communication. But we need some extra communication data lines to initialize and control the session.
There are four communication channels are being used for communication as shown in above figure. First channel in above figure is session initialization which asks the output controller that information is being sent to output controller. Then it gives some time to output controller to get ready for receiving information from input controller. Then it sends information as single bit on 2’nd channel. 3’rd pin indicates that data has been written to the 2nd channel so, output controller can read value from receiving channel. Output controller set the value on 4th channel when it gets read the information from input controller. Here is detailed stepwise information for above protocol
The above technique works fine to some extend but again have some disadvantages. It may happen that microcontrollers get disconnected in between the communication gets started and input or output controller is waiting for each other to start next turn. Our system may get failed if microcontroller communication channels are low speed or have external impurities. Universal Asynchronous Receiver/Transmitter is another standard protocol to transmit bit sequentially from bytes and then other end receiver re-assembles these bits into bytes. It is being used in so many computers and network devices where there is need of serial communication. UART sends information in between start and stop bits. Start bit is the 0 by default and stop bit is 1 by default and all the data is transmitted or received in between these two bits. So, we have an opportunity to use UART for communication in between input and output microcontroller. Here is a graphical representation of system as
Figure 4: UART Transmission
UART protocol has two interfaces for external system, Transmitter and Receiver. Transmitter transmits bytes data in series using bit by bit in a sequence. Receiver will receive these bits and then assemble them into bytes. So, from input microcontroller we will read the switch which user pressed and then we will send the corresponding value of that switch to UART transmitter which will be connected with output microcontroller receiver. Output microcontroller will receive these transmitter bits and computer bytes after assembling these bits as shown in below figure
Figure 5: Logic Controller Transmission
From above figure, we can see that there is one data line which is being connecting from input microcontroller to output microcontroller. Input microcontroller will transmit data on this line meanwhile output controller will receive this data. Thus we will send unique identifier through input microcontroller and receiver will receive that identifier. Here is our end product
Figure 6: Electrikitty Light Controller