Learn To Write Code For 8051, Arduino, AVR, dsPIC, PIC, STM32 ARM Microcontroller, etc.
Coding Embedded Controller With C/C++.
Printed Circuit Board (PCB) Project For Electronics Hobbyists.
Using a prototype board for micro-controller firmware testing could save time and safer. Putting an on-board device programmer with prototype board could be more satisfy for electronic hobbyists.
I have some PIC18 and PIC16 series of micro-controllers left from previous projects. I don't know what to do with them anymore. So I put them on single board to PIC program testing next time I need them without checking their pin diagram, and wiring them on bread board.
PCB Front View
PCB Back View
I designed a PCB with a
PICKit2 device programmer (with AVR ISP header)
+5VDC and +3.3VDC low drop out power supply
RS-232 to TTL logic converter
I2C DS1307 RTC and 24LC08 EEPROM
4-bit LCD (HD4478)
3-digit 056'common cathode multiplexing display
One passive buzzer with transistor driver (using CCP1 PWM output pin of PIC16F876A)
8-LED that connects to PORTC of PIC16F876A
A 4x4 keypad matrix that connects to PORTB of PIC16F876A
Three analog inputs (one LM35 and two potentiometers) that connect to RA0...RA1 of PIC16F876A.
A 28-pin IC socket for 28-pin PIC devices
A 20-pin IC socket for 20-pin PIC devices
A 18-pin IC socket for 18-pin PIC devices
A 14-pin IC socket for 14-pin PIC devices
And a 8-pin IC socket for 8-pin PIC devices
This board seem to be a large PCB with two copper layer near a size of an A4 paper that I'm not yet fabricate it. It need a PCB fabrication service.
Schematic
I use Protues VSM Release 8.16 SP3 to design draw its circuit diagram. Some components are not in its original libraries. So I find and download some devices symbol, footprints and 3D objects from snapeda website. I separate its schematic into A4 sheets.
Sheet #1
Sheet #2
Sheet #3
Sheet #4
Sheet #5
This board could fit,
28-pin PIC microcontrollers: PIC16F876A, PIC16F886, etc.
20-pin PIC microcontrollers: PIC16F1459(USB), PIC16F690, etc.
18-pin PIC microcontrollers: PIC16F1827, PIC16F84A, PIC16F818, etc.
14-pin PIC microcontrollers: PIC16F630, PIC16F676, etc.
8-pin PIC microcontrollers: PIC12F629, PIC12F675, PIC12F683, etc.
These are some mid-range PIC micro-controllers I have at my own workshop.
Printed Circuit Board (PCB)
This board size is 8.02x6.30 inches that could be a little bit expensive to order from any professional PCB fabrication service. But if we need to use it with classmate or friend the share cost is cheaper.
Top Copper non-mirror
Bottom Copper
Top Silk
I preview this PCB on an online Gerber viewer software.
I have been using PCBWay for many years now. PCBWay fabricate PCBs at low cost,
fast processing time for only 24 hours, and fast delivery time using
any carrier options. This double side 10cmx10cm can be fabricate at only
5USD for 5 to 10pcs by PCBWay. It's a standard PCB with silk screen and
solder mask.
PIC16F630 is an 8-bit PICMicro released a decade a go. I bought a dozen of it for a simple project at a company at that time. So fa, I still have them left in my components storage box.
It's a 14-pin device with a DIP package enable good choice for hobbyist prototyping. The device typically supplied from 2.0 V to 5.5 V, normally 5 V is preferred for most peripheral device interfacing.
The program memory is 1024 words, with 64 bytes of internal SRAM. The auxiliary non-volatile memory EEPROM is 128 bytes.
It could clock up to 20 MHz. However with ease of prototyping and spacing saving, we can use it's internal RC oscillator that could clock up to 4 MHz with 1% error.
In this example, reading a temperature from one-wire device and just making a display, selecting this device is more economics.
The DS18S20 1-Wire Digital Temperature Sensor
DS18S20 is digital thermometer come with only three pins, two supply pin and one bi-directional data pin.
DS18S20 sample picture an pin diagram
The device comes with both TO-92 and SMD package. A TO-92 is preferred for most student and hobbyist prototyping.
Temperature resolution is 9-bit. The temperature conversion ranges from -55 to +125 degree Celsius. The result includes one bit of fraction with the fraction number of 0.5 degree Celsius.
It needs a DC supply voltage from 3.0 V to 5.5 V. The data DQ pin is open-drain, thus requires a pull up resistor with the resistance from 4.7 to 10 kOhm depending on the wire length.
One-wire protocol made by the manufacturer requires a good embedded programming skill. It needs a precise timing, and there a lot of device command such as a Skip ROM and a Read Scratchpad command.
For a single device connection, the reading process is simpler. A single DS18S20 device temperature reading flow list below.
A screen shot from device datasheet. Here there's a single DS18S20 connected on the bus.
For timing diagram and data transfer criteria, please check its datasheet on the web.
CCS PICC Programming And Interfacing
CCS PICC includes a driver for one-wire device reading. It works with DS1820, DS18S20 and DS18B20 1-wire device.
CCS PICC 1-Wire Driver
The touch.c contains many function to work with 1-wire device.
data = touch_read_bit() Reads one bit from a touch device
data = touch_read_BYTE() Reads one byte from a touch device.
ok = touch_write_bit(data) Writes one bit to a touch device and returns true if all went ok. A false indicates a collision with another device.
ok = touch_write_byte(data) - Writes one byte to a touch device and returns true if all went ok. A false indicates a collision with another device.
present = touch_present() - Issues a reset and returns true if the touch device is there.
reset_pulse() - Issues a reset and waits for a present pulse.
Programming And Circuit Simulation
I planned the circuit requirement as per in the schematic.