Schematics

Circuit description

On the top left, we find the USB connector CN2. From pin 1 of CN2 we obtain the 5 V USB power supply which are brought out of the circuit via terminal +5USB. From D2 and JP1, the 5 V supply comes to U1, the voltage regulator. U1 can be powered by an external supply via the VIN terminal. The 3.3V regulated voltage from U1 is available on the VREG terminal (top right in the schematics) and, through JP2, is used to power up all the microcontroller circuit. If JP2 is disconnected, Pierin PIC18 can be powered up via the VDD terminal. Capacitors C3, C4 and C5 are useful to bypass the power supply. C6 and C7 on the left of the schematics are useful for the voltage regulator U1. On the left, we find the RESET switch, X1 the 12 MHz crystal and the two capacitors for the oscillator C8 and C9. On the right, there is the connector for PicKit3 programmer. On the bottom, we find buttons PL0 and PL1 with the pull-up resistances, connected respectively to pins RD4 and RD5 of the microcontroller. On the right-bottom, you can see the two LEDs. They are not directly driven by the microcontroller pins, but via MOSFETs Q1 and Q2. This avoids loading the I/O pins unnecessarily.

Connections

Starting the description from the top of the drawing, we have a 6-pin connector for the emulator/debugger PicKit3 which is useful for programming the microcontroller and for code debugging. However, Pierin PIC18 is pre-loaded with a bootloader and so you will not need external hardware, the code being written on it directly from the USB connection with the PC (on the bottom of the drawing).
Jumpers JP1 and JP2 are very important, since they are used to configure the power supply strategy of the Pierin PIC18. In the following table, we summarize all the possible configurations.

Configurations of JP1 and JP2 jumpers

JP1 JP2 Description
ON ON Il works in the stand-alone mode. Power supply is derived by the USB connection and the 5 V as well as the 3.3V lines are available to the user. Output +5USB is tied to the USB 5 V power line; VDD and VREG are connected to the regulated 3.3V line.
OFF ON Il needs an external power supply (min 4.3 V, max 12 V) applied to terminal VIN, since the USB power lines are disconnected. The 3.3V voltage regulator is used for the microcontroller and eventually an external circuit. VDD and VREG are connected to the regulated 3.3V line.
ON OFF The voltage regulator is fed by USB, but it is not connected to the microcontroller power supply. The latter therefore needs an external supply (min xxV, max yyV) on the VDD terminal, here used as an input. Pin VREG is an output and regulated 3.3V are available there.
OFF OFF The voltage regulator is not connected neither to USB nor to the microcontroller. The latter requires an external power supply (min xxV, max yyV) to be applied to VDD terminal.

Examples for JP1 and JP2 configuration.

  • I want to use as a stand-alone module, connected to USB just to do some tryouts. I want it to be powered via USB.
    Set JP1=ON and JP2=ON

  • I mounted on a breadboard or on an universal board and it is connected to the PC via USB. I do not have a bench power supply, and I would like to derive 5 V and 3.3V from USB to power my circuit.
    Set JP1=ON and JP2=ON. You can find 5 V on the +5USB terminal and 3.3V on the VREG and VDD terminals. Note than you can not draw too much current from USB. More than 100mA might damage your computer, or the USB hub you are using!

  • is used in a circuit which already has its own 5 V (or more) power supply, but no 3.3V rail is available. I do not want to use the USB power (even if a PC is connected), but I want to use the power supply coming from my circuit.
    Set JP1=OFF and JP2=ON. If you need the 3.3V voltage, you can find it at VREG and VDD terminals.

    And if I forget JP1 on, can I damage the circuit or the PC?
    No, since some protection diodes are useful for keeping magic smoke in the devices.

  • I want to use for my prototype, which has all the required power supply rails. I do not want to use the onboard voltage regulator. I still want to connect Pierin PIC18 to the PC via USB.
    Set JP1=OFF and JP2=OFF and fed the microcontroller with the external 3.3V rail via VDD VDD termina.

  • I own a PicKit3 and I would like to use it to power . I would like to continue using USB.
    Set JP1=OFF and JP2=OFF. This way, the microcontroller will be powered just by PicKit3.