I recently supported an excellent Kickstarter project called PCBGRIP. The project plans to build a PCB vice/work-center that goes way beyond the classic Pana-Vise setup. If you are looking for a great system for holding PCBs and components as you assemble them you should check it out.
This blog acts as my own engineering journal while I explore the world of Embedded Systems development. I am also hoping that this blog helps others like me as they start their journey and design their own projects. If you have any questions or comments related to this blog please post them.
Saturday, February 8, 2014
Wednesday, September 11, 2013
Simple Photosensor
The goal of this project was to create a simple light sensor that would detect whenever a certain amount of light was present. This output could be used to drive an LED or an input pin on the PIC32. To design the circuit I used the Eagle schematic editor. Eagle is made by CadSoft and is a powerful PCB CAD tool for designing PCB schematics and layouts. The Eagle light edition is provided free of charge to hobbyists and is powerful enough for most projects. In my case I only used the schematic portion of the software as I implemented the circuit on a breadboard instead of a PCB.
The circuit works by creating a voltage divider using the Photoresistor (R1) and a base resistance (R2). The output voltage of that circuit will be:
Vout = (R2/(R1+R2))*Vin
The inverter's switch-point (when it transitions from a logical 1 to a 0) is roughly half of VCC. Given this we know that the inverter will switch when R1 equals R2. We can select how much light will trigger the sensor by select the value of R2. The more light the Photoresistor receives, the lower its resistance, so a lower value of R2 means we need more light to trigger the sensor. In this schematic the output of the sensor is used to drive an NPN transistor so that a logical 0 will cause the LED to light up. The output of the inverter could just have easily been connected to one of the PIC32's input pins where software could react based on the input (with a logical 0 meaning that the sensor has triggered since we are using an inverter).
Saturday, March 24, 2012
Controlling the Explorer 16 On-board Truly LCD
The Explorer 16 board comes equipped with a small LCD display controlled by a Novatek NT7603 LCD Controller. There are four signals used to control the NT7603 from the PIC32 (marked MPU in the diagram):
- RS - Register select: Selects between the Instruction and Data registers.
- E - Enable: Asserted high to start a read/write transaction.
- RW - Read not Write: When asserted indicates a read, de-asserted indicates a write.
- DATA - Data Bus: An 8-bit bus containing the data to be read/written to the indicated register.
RS <-> RB15
E <-> RD4
RW <-> RD5
DATA <-> RE0 - RE7
The databook describes the protocol for a read and write operation and describes a basic initialization flow. The code linked below shows my implementation of that flow, along with a puts_lcd(char* string) helper function which can be used to write a string to the display.
The biggest challenge with implementing this code was figuring out what controlled the LCD screen on the Explorer 16 and finding a databook for that controller. I also found this controller a little difficult to work with as it seems to be very sensitive to the timings of the various commands. If you run into trouble use a Logic Analyzer to ensure that you are meeting the minimum delays after each command type before issuing the next command. Also ensure you are meeting the minimum timings for the write and read operations. These delays and timings are all listed in the databook.
Code:
References:
- NT7603 LCD Controller / Driver Databook
Subscribe to:
Posts (Atom)