The manipulates flip-flops and performs data exchange with PC

The aim of this project was to design and build an LEDcube capable of displaying 3D images and communicating with PC via USB 2.0(fig. 1.0).

Figure 1.0 Project block diagram. It involved designing three PCB boards:·        Power board – for supplying 5V to the following two PCBs inthis list.

We Will Write a Custom Essay Specifically
For You For Only $13.90/page!


order now

·        Flip-flop board – for switching cube LEDs ON and OFF at highspeed, this way generating 3D visual picture.·        Controller board – containing PIC microcontroller whichmanipulates flip-flops and performs data exchange with PC via USB connection.However, beforehand a functioning prototype was built inorder to become familiar with all components involved in the project (fig 1.1).After making sure that LED cube operates as expected all three PCB boards weredeveloped in Ultiboard program and printed. The controller PCB board was designed to have ICSP(In-Circuit Serial Programming) circuit with 5 pin socket for a PICKit2programmer.

That facilitated PIC microcontroller programming without physicallyremoving it from the board. Figure 1.1 LED cube and controller prototype. This report describes the main aspects of the software(SW) and firmware (FW) development processes.

The code for the user interfacewas written in Visual C# 2010 Express program. Aspecial class was added to the C# project which containedhost software functions for performing USB HID communication. USB functionswere successfully used for data transmission between the host and PICcontroller. Firmware code was developed in the MPLAB program using Cprogramming language. Both FW and SW codes with comments are available inthe appendix at the end of this report. 2. Literature survey 2.1 LEDLight-emitting diodes(LEDs) are semiconductor devices that convert electrical current into light.

LED lighting is also called “solid state lighting” because the light is emittedfrom a solid object rather than from a vacuum or gas tube, as in traditional incandescentor fluorescent lights. Light-emitting diodes have significant potentialfor energy savings compared to other illumination devices, for instance LEDsare 10 times more efficient than incandescent lights. Even though LEDtechnology has existed in specialized applications since the 1960s but itbecame widespread only after the invention of the blue LED which made whitelight generation possible (Gereffi and Lowe, 2008). LEDs have been used widelyto create the highly efficient red, green, and blue lights in devices such asdigital clocks, watches, televisions, dashboards, and traffic lights. In 1993Japan’s Nichia Corporation devised a way to create white light from a singlediode. This discovery initiated the ongoing quest to develop an LED-basedtechnology that can produce a high-quality, “warm” white light suitable forgeneral illumination (Gereffi and Lowe, 2008). General LED operation canbe described as follows: a current flows through a diode in the forwarddirection, it consists of surplus electrons moving in one direc­tion in thelattice and “holes” (voids in the lattice) moving in the other.

Occasionally,electrons can recombine with holes. When this happens the process releasesenergy in the form of photons, i.e. light is produced. This is true of allsemiconductor junctions, but LEDs use materials that maximize the effect. Thecolour of the light emitted (corresponding to the ener­gy of the photon) isdetermined by the semiconduc­tor materials that form the diode junction (Tuite,2013). A figure below shows internal parts of an LED.  Figure 2.

1.0 Internal parts of an LED (Wikipedia, 2009).  2.2 Flip-FlopD type flip-flops(Fig. 2.2.0, a) are basic storage elements (memory cells) in digitalelectronics. They transfer input data to the outputs on an edge (positive ornegative) transition of the clock input providing a robust interface betweenasynchronous and synchronous systems (www.

nxp.com, 2015).a)                         b) Figure 2.

2.0 D flip-flop block diagramand logic diagram. Theoutput Q (Fig.

2.20, b) tries to track the D input, but this happens only whenthe CLK input is high. The instance when CLK signal becomes low the Q outputkeeps the last D value until CLK becomes high again, then Q resumes tracking theD input. The timing diagram on Fig. 2.2.1 shows that Q acquires D input valueonly when CLK is high. Figure 2.

2.1 D flip-flop timing diagram. However, octalD flip-flops used in this project allow the Q to acquire value of the D inputonly on the rising edge of the clockas shown in Fig. 2.2.

2 a and b. a)                  b) Figure2.2.2 D flip-flop truth table and timing diagram.

 74HC374Octal D-type flip-flops (Fig. 2.2.

3) have 3-state outputs and the capability todrive 15 LSTTL (Low-Power Schottky Transistor-Transistor Logic) loads. Theeight edge-triggered flip-flops enter data through D0 to D7 pins into theirregisters on the LOW to HIGH transition of clock (CLK) (Fig. 2.2.2 a). The outputenable (OE) controls the 3-state outputs (Q0 to Q7 pins) and is independent ofthe register operation. When OE is HIGH, the outputs are in the high-impedancestate and when it is LOW the chip outputs values that were store in it (TexasInstruments, 2014). Figure2.

2.3 74HC374 Octal D-type flip-flop pinout. 2.3 De-MuxA decoder is a device which doesthe reverse operation of an encoder, undoing the encoding so that the originalinformation can be retrieved. It is a combinational circuit that convertsbinary information from n input lines to a maximum of 2n uniqueoutput lines (Wikipedia, 2015). The decoders are designed to be used in memory-decodingor data routing applications requiring very short propagation delay times.

Figure 2.3.0 shows 3-line to 8-linedecoder pinout.

The conditions at the binary-select inputs (A, B and C) andthree enable inputs select one of eight output lines. Two active-low and oneactive-high enable inputs (G1, 2A and 2B) reduce the need for external gates or inverters whenexpanding. An enable input can be used as a data input in demultiplexingapplication, such as this project. It has a propagation delay time of only 15ns (Texas Instruments, 2003). Figure2.3.0 S74HC138 De-Mux pinout. The table below shows how inputscan be decoded using S74HC138 chip.

Table2.3.0 S74HC138 De-Mux functional table. 2.

4PICA microcontrolleris a small computer on a single integrated circuit (IC) containing a processorcore, memory, and programmable input/output peripherals. Microcontrollers aredesigned for embedded applications, in contrast to the microprocessors used inpersonal computers or other general purpose applications.Microcontrollers are used in automaticallycontrolled products and devices, such as automobile engine control systems,implantable medical devices, remote controls, office machines, appliances,power tools, toys and other embedded systems.

By reducing the size and costcompared to a design that uses a separate microprocessor, memory, andinput/output devices, microcontrollers make it economical to digitally controleven more devices and processes (Wikipedia,2014). Figure 2.4.0 displays 40 pin 18F4550 PICmicrocontroller which has high computational performance at an economicalprice, with the addition of high endurance and enhanced Flash program memory.

This device incorporates a fully featured USB (Universal Serial Bus)communications module that is compliant with the USB Specification Revision2.0. The module supports both low-speed and full-speed communication for allsupported data transfer types. It also incorporates its own on-chip transceiverand 3.

3V regulator. The Flash cells for both program memory and data EEPROM arerated to last for many thousands of erase/write cycles – up to 100,000 forprogram memory and 1,000,000 for EEPROM (Microchip, 2006).   Figure 2.4.0 PIC 18F4550 Microcontroller (Microchip, 2006). 2.5 SwitchingVoltage RegulatorsA voltage regulator is designed to automatically maintain a constantvoltage level (Wikipedia, 2015).

LM2576 voltage regulator (Fig. 2.5.0) is monolithic integrated circuitthat provides all the active functions for a step-down (buck) switchingregulator, capable of driving 3A load with excellent line and load regulation.These devices are available in fixed output voltages of 3.3V, 5V, 12V, 15V, andas adjustable output version.

Requiring only a few external components, theseregulators are very simple to use and include internal frequency compensationand a fixed-frequency oscillator. The LM2576 series offers a high-efficiencyreplacement for popular three-terminal linear regulators. It substantiallyreduces the size of the heat sink, and in some cases no heat sink is required(Texas Instruments, 2013). A typical application of LM2576 is shown below inFig. 2.5.1.

Other features include aspecified ± 4% tolerance on output voltage within specified input voltages andoutput load conditions, and ± 10% on the oscillator frequency. Externalshutdown is included, featuring 50 ?A (typical) standby current. The outputswitch includes cycle-by-cycle current limiting, as well as thermal shutdown forfull protection under fault conditions (Texas Instruments, 2013).  Figure 2.5.0LM2576 IC (ti.

com, 2015).   Figure2.5.1 LM2576 Application circuit from datasheet (ti.

com, 2013). 2.6 USBUSB is currently a very popular computer interfacespecification used to connect various peripheral devices to computers andmicrocontrollers. Some microcontrollers provide built-in USB modules.

The18F4550, for example, has built-in USB interface capabilities. The USB is a high-speed serial interface that can alsoprovide power to devices connected to it. According to the specification, themaximum distance of a device from its host is about thirty meters, accomplishedby using five hubs.

For longer-distance bus communications, other methods suchas use of Ethernet are recommended.The USB bus specification comes in three versions: ·        The earlier version, USB1.1, supports 11Mbps.·        USB 2.0 supports up to 480Mbps.·        While the new version USB 3.

0 supports the payloadthroughput up to 4 Gbps. However, this project implements USB 2.0 and therefore allfurther information is related only to USB 2.0 version.The maximum power available to an external USB device islimited to about 100mA at 5.0V (Ibrahim, 2008).Figure 2.6.

0 showstypical USB connectors. Figure 2.6.0 USB connector. USB is a four-wire interface implemented using a four-core shieldedcable. Two types of connectors are specified and used: type A and type B.

Thepin-out of each type is shown below in figure 2.6.1. Figure 2.6.1 Type A and B connector. All four wires have specified colours. The pins and wirecolours of a Type A or Type B connector are given in table 2.

6.0 below. Pin # Name  Colour 1 + 5.0 V Red 2 Data – White 3 Data + Green 4 GND Black Table 2.6.0 USB connector pins. 2.7 UltiboardUltiboard is a rapid printed circuit board(PCB) prototyping environment used by engineering professionals, educators,makers, and students across many applications.

Its seamless integration withMultisim helps circuit designers save hours of development time with theability to complete circuit schematics, SPICE simulation, and PCB layout in thesame environment. Ultiboard benefits include the following (National Instruments, 2015): Flexible environment optimized for rapid design and accurate part or copper placement. Engineer-friendly interface for laying out and routing PCBs. Seamless integration with Multisim to ensure accurate transfer of simulated designs. Comprehensive database of connector footprints for custom designing NI hardware and test platforms. Easy export to industry-standard Gerber or DXF formats for prototyping and fabrication. 2.

8 MultisimMultisimis an industry-standard, best-in-class SPICE simulation environment. It is thecornerstone of the NI circuits teaching solution to build expertise throughpractical application in designing, prototyping, and testing electricalcircuits. The Multisim design approach helps to save prototype iterations andoptimize printed circuit board (PCB) designs earlier in the process (NationalInstruments, 2015). 2.

9 MPLABMPLAB IDE is a software program that runs on a PC(Windows, Mac OS, Linux) to develop applications for Microchip microcontrollersand digital signal controllers. It is called an Integrated DevelopmentEnvironment (IDE), because it provides a single integrated”environment” to develop code for embedded microcontrollers. MPLABsupports C Compiler for PIC18 (Microchip, 2015). 2.10 C Compiler for PIC18TheMPLAB C Compiler for PIC18 MCUs (also known as MPLAB C18) is a full-featured ANSIcompliant C compiler for the PIC18 family of PICmicro 8-bit MCUs. MPLAB C is a32-bit Windows console application as well as a fully integrated component ofMicrochip’s MPLAB Integrated Development Environment (IDE), allowing sourcelevel debugging with MPLAB’s software and hardware debug engines (Microchip,2015).

Features:·               ANSI ’89 compatibility.·               Integration with the MPLAB IDE for easy-to-use project management andsource-level debugging.·               Compatibility with object modules generated by the MPASM assembler,allowing complete freedom in mixing assembly and C programming in a singleproject.·               Transparent read/write access to external memory.·               Efficient code generator engine with multi-level optimization.·               Extensive library support, including PWM, SPI, I2C, UART, USART, stringmanipulation and math libraries.·               Full user-level control over data and code memory allocation.

·               MPLIB allows easy use of included libraries and for user createdlibraries.·               Extensive multi-pass optimizations.·               Supports new PIC18F extended mode instructions. 2.11Microsoft Visual C#C# is a programming language that is designed forbuilding a variety of applications that run on the .NET Framework. C# issimple, powerful, type-safe, and object-oriented. The many innovations in C#enable rapid application development while retaining the expressiveness andelegance of C-style languages.

Visual C# is an implementation of the C#language by Microsoft. Visual Studio supports Visual C# with afull-featured code editor, compiler, project templates, designers, codewizards, a powerful and easy-to-use debugger, and other tools. The .NETFramework class library provides access to many operating system services andother useful, well-designed classes that speed up the development cyclesignificantly (Microsoft, 2015). 2.12 Flicker fusionthresholdThe flicker fusion threshold (or flicker fusion rate) is a concept in the psychophysics of vision.It is defined as the frequency at which an intermittent light stimulus appearsto be completely steady to the average human observer. Flicker fusion thresholdis related to persistence of vision.

Although flicker can be detected for manywaveforms representing time-variant fluctuations of intensity, it isconventionally, and most easily, studied in terms of sinusoidal modulation ofintensity. There are seven parameters that determine the ability to detect theflicker (Wikipedia, 2015): The frequency of the modulation. The amplitude or depth of the modulation (i.e.

, what is the maximum percent decrease in the illumination intensity from its peak value). The average (or maximum-these can be inter-converted if modulation depth is known) illumination intensity. The wavelength (or wavelength range) of the illumination (this parameter and the illumination intensity can be combined into a single parameter for humans or other animals for which the sensitivities of rods and cones are known as a function of wavelength using the luminous flux function).

The position on the retina at which the stimulation occurs (due to the different distribution of photoreceptor types at different positions). The degree of light or dark adaptation, i.e., the duration and intensity of previous exposure to background light, which affects both the intensity sensitivity and the time resolution of vision. Physiological factors such as age and fatigue.

 2.13 LED CubeLED cube can be separated into columns and layers. The cathode legs ofevery LED in a layer are soldered together, and all the anode legs in onecolumn are soldered together as in fig. 2.13.0 b) and a) accordingly.                                     a)                                                                                 b)Figure2.

13.0 LED cube. Columns (a) and layers (b). Each of the 64 anode columns are connected to a separate current sourcecontrolled by the microcontroller.

This way each column can be actuated independently.Then all eight layers have a separate connection to the sink switch connectedto the microcontroller as well. By operating sink switches controller can sinkthe current from one layer at a time, i.e.

the image projected on the 64 anodewires can be displayed on the layer which is currently enabled. To display the image on the first layer the controller closes the sinkswitch for layer one, disables all other layers (opens their sink switches) andoutputs the desired bit pattern (image) on 64 columns (anodes). To display adifferent image on the second layer the first layers is disabled, the secondlayer is enabled and 64 bit pattern is changed on anodes. In this manner alllayers are updated with different 2D images. This multiplexing produces a 3Dimage provided that all operations on layer such as update and refresh areperformed fast enough that human eye cannot see the flickering effect.       3.

Methodology (hardware) 3.1 LED CubeThe size ofLED cube was chosen to be 8x8x8 LEDs as this produces sufficient resolution todisplay 3D images such that they could be recognized by an observer. Inaddition to that small dimensions of the cube are important as this is aportable device designed for presentations. MonochromeLEDs were chosen over RGB LEDS for four reasons:1.     Monochrome LEDs are much cheaper than RGBLEDs.2.     The wiring is reduced two times (monochromeLEDs have 2 pins, RGB – 4 pins).3.

     Colour blending is not required andtherefore the code is less complex.4.     Monochrome LEDs have better visibility in awell-lit environment.

Anotherimportant point on LEDs was their viewing angle which is the maximum angle at which an LED can be viewed withacceptable visual performance. Since the cube can be looked at from differentangles the viewing angle had to be as wide as possible. Usually clear LEDs havenarrow viewing angles; consequently the choice fell on diffused LEDs eventhough they are slightly dimmer than clear LEDs.750 piecesof 5 mm LEDs were purchased with the following specifications: Manufacturer: Kingbright Product Category: Standard LEDs – Through Hole Luminous Intensity: 20 mcd Wavelength/Colour Temperature: 565 nm Lens Colour/Style: Diffused Forward Current: 10 mA LED Size: T-1 3/4 Mounting Style: Through Hole Table 3.1.0LED specs.

 Some LEDs had defects on them as shown infig. 3.1.0, thus, all LEDs had to be checked before proceeding to the next step.