Introduction: Building Myself a PSLab
Busy day at electronics lab eh?
Have you ever had any problems with your circuits? To debug you knew that you wanted a multi-meter or an oscilloscope or a wave generator or an external precise power source or say a logic analyzer. But it's a hobby project and you don't want to spend hundreds of dollars on expensive tools like that. Not to mention the whole set above takes a lot of space to keep. You might end up with a 20-30 dollars worth multi-meter but it's not really doing a good job debugging the circuit.
What if I say, there is an open source hardware device that provides all those functionalities of an oscilloscope, a multi-meter, a logic analyzer, a wave generator and a power source and it's not going to cost you hundreds of dollars and not going to take a whole table to fill. It is the PSLab device by FOSSASIA open source organization. You can find the official website at https://pslab.io/ and the open source repositories from following links;
- Hardware schematics : https://github.com/fossasia/pslab-hardware
- MPLab Firmware : https://github.com/fossasia/pslab-firmware
- Desktop app : https://github.com/fossasia/pslab-desktop-apps
- Android app : https://github.com/fossasia/pslab-android
- Python Libraries : https://github.com/fossasia/pslab-python
I maintain the hardware and firmware repositories and if you have any questions while using the device or any other related stuff, feel free to ask me.
What does PSLab give us?
This compact device with the form factor of an Arduino Mega has a tons of features. Before we start, it is made in Mega form factor so that you can put this in your fancy Arduino Mega casing without any trouble. Now let's have a look at the specifications (extracted from the original hardware repository);
- 4-Channel up to 2MSPS Oscilloscope. Software selectable amplification stages
- 12-bit Voltmeter with programmable gain. Input ranges from +/-10 mV to +/-16 V
- 3x 12-bit Programmable voltage sources +/-3.3 V,+/-5V,0-3 V
- 12-bit Programmable current source. 0-3.3 mA
- 4-Channel, 4 MHz, Logic Analyzer
- 2x Sine/Triangular wave generators. 5 Hz to 5 KHz. Manual amplitude control for SI1
- 4x PWM generators. 15 nS resolution. Up to 8 MHz
- Capacitance Measurement. pF to uF range
- I2C, SPI, UART data buses for Accel/gyros/humidity/temperature modules
Now that we know what this device is, let's see how we can build one..
Step 1: Let's Start Off With the Schematics
Open Source hardware goes with Open Source software :)
This project is in open formats where ever possible. This has many advantages. Anyone can install the software for free and try out. Not everyone has a financial strength to buy proprietary software so this makes it possible to still get the job done. So the schematics were made with KiCAD. You are free to use any software you like; just get the connections right. The GitHub repository contains all the source files for schematics at https://github.com/fossasia/pslab-hardware/tree/m... and if you are going to go with KiCAD, we can straight away clone the repository and have the source to ourselves by typing following command in a Linux terminal window.
$ git clone https://github.com/fossasia/pslab-hardware.git
Or if you are not familiar with console commands, just paste this link on a browser and it will download the zip file containing all the resources. The PDF version of schematic files can be found below.
The schematic may looks a bit complicated as it contains a lot of ICs, resistors and capacitors. I'll walk you through what's in here.
At the center of the first page, it contains a PIC micro-controller. That is the brain of the device. It is connected with several OpAmps, a Crystal and a few resistors and capacitors to sense electric signals from I/O pins. Connection with a PC or a mobile phone is done through a UART bridge which is MCP2200 IC. It also has a breakout opening for a ESP8266-12E chip at the back of the device. Schematics will also has a voltage doubler and a voltage inverter ICs as the device can support oscilloscope channels that can go upto +/-16 V
Once the schematic is done, next step is to build up the real PCB...
Step 2: Converting the Schematic Into a Layout
OK yes, this is a mess right? That is because hundreds of small components are placed in a small board, specifically on one side of a small board of a size of an Arduino Mega. This board is a four layer one. This much layers were used to have better track integrity.
Board dimensions are to be exact as Arduino Mega and the pin headers are placed at the same places where the Mega has its pins. In the middle, there are pin headers to connect the programmer and a Bluetooth module. There are four test points on top and four on bottom to check if the correct signal levels are getting at correct connections.
Once all the footprints are imported first thing is to place the micro-controller at the center. Then place the resistors and capacitors that are directly connected with micro-controller around the main IC and then progress through until the last component is place. It is better to have a rough routing before the actual routing. Here I've invested more time on neatly arranging the components with proper spacing.
As the next step let's have a look at the most important bill of materials..
Step 3: Ordering the PCB and the Bill of Materials
I have attached the bill of materials. It basically contains following content;
- PIC24EP256GP204 - Microcontroller
- MCP2200 - UART bridge
- TL082 - OpAmps
- LM324 - OpAmps
- MCP6S21 - Gain controlled OpAmp
- MCP4728 - Digital to Analog Converter
- TC1240A - Voltage Inverter
- TL7660 - Voltage doubler
- 0603 sized resistors, capacitors and inductors
- 12MHz SMD Crystals
When placing the PCB order, make sure to have following settings
- Dimensions: 55mm x 99mm
- Layers: 4
- Material: FR4
- Thickness: 1.6mm
- Minimum Track Spacing: 6mil
- Minimum Hole Size: 0.3mm
Step 4: Let's Start With the Assembly
When the PCB is ready and the components have arrived, we can start with assembly. For this purpose we better have a stencil so that the process is easier. First, place the stencil aligned with pads and apply the solder paste. Then start placing components. The video here shows a time-lapsed version of me placing components.
Once every component is placed, re-flow solder it using an SMD rework station. Make sure not to heat up the board too much as the components might fail in the face of intense heat. Also don't stop and do many times. Do it in one sweep as letting the components get cold and then heating up will fail the structural integrity of both the components and the PCB itself.
Step 5: Upload the Firmware
Once the assembly is complete, the next step is to burn the firmware onto the micro-controller. For this, we need;
- PICKit3 Programmer - To upload the firmware
- Male to male jumper wires x 6 - To connect the programmer with PSLab device
- USB Mini B type cable - To connect programmer with PC
- USB Micro B type cable - To connect and power up PSLab with PC
The firmware is developed using MPLab IDE. First step is to connect the PICKit3 programmer to PSLab programming header. Align the MCLR pin in both the programmer and the device and the rest of the pins will be placed correctly.
The programmer itself cannot power up the PSLab device as it cannot provide much power. So we need to power up the PSLab device using an external source. Connect the PSLab device to a computer using Micro B type cable and then connect the programmer to same PC.
Open up MPLab IDE and click on "Make and Program Device" from the menu bar. It will open up a window to select a programmer. Chose "PICKit3" from the menu and press OK. It will start burning the firmware to device. Watch out for messages being printed on console. It will say it detects the PIC24EP256GP204 and finally the programming is complete.
Step 6: Power It Up and Ready to Go!!
If the firmware burns correctly, the green color LED will light up which indicates a successful boot cycle. Now we are ready to use the PSLab device to do all sort of electronic circuit testing, perform experiments etc.
The images show how the desktop app and the Android app looks.
Participated in the