Electronics Experiments with PSLab

Numerous college level electronics experiments can be performed using Pocket Science Lab (PSLab). The Android app and the Desktop app have all the essential features needed to perform these experiments and both these apps have quite a large number of experiments built-in. Some of the common experiments involve the use of BJT (Bipolar Junction Transistor), Zener Diode, FET (Field Effect Transistor), Op-Amp ( Operational Amplifier) etc. This blog walks through the details of performing some experiments using the above commonly used elements.   The materials required for all the experiments are minimal and includes a few things like PSLab hardware device, components like Diodes, Transistors, Op-Amps etc., connecting wires/jumpers and secondary components like resistors, capacitors etc. Most of these elements would be a part of the PSLab Accessory Kit. It is recommended to read this blog here, go through the resources mentioned at the end and also get acquainted with construction of circuits before advancing with the experiments mentioned in this blog. Half Wave and Full Wave Rectifiers The Bipolar Junction Transistor (BJT) can be used as a rectifier. Rectifiers are needed in circuits to obtain a nearly constant and stable output voltage and prevent any ripples in the circuit. The rectifier can be half wave or full wave depending on whether it rectifies one or both cycles of Alternating Voltage. The circuit for the Half and Full Wave rectifier is given as follows: Construct the above circuits on a breadboard. For the half wave rectifier, connect the terminals of CH1 and GND of PSLab on the input side and the terminals of CH2 and GND on the output side. The terminals of W1 and GND are also connected on the input side and they are used to generate a sine wave. Use the PSLab Desktop App and open the Waveform Generator in Control. Set the wave type of W1 to Sine and set the frequency at 100 Hz and magnitude to 10mV. Then go ahead and open the Oscilloscope. CH1 would display the input waveform and CH2 will display the output waveform and the plots can be observed. The plot obtained will have rectification in only half of the cycle. In order to obtain rectification in the complete cycle, the full wave rectifier is needed. For the full wave rectifier, the procedure is the same but an additional diode is used. Use an additional channel CH3 to plot the extra input. The plot obtained from the above steps would still have ripples and so a capacitor is placed in parallel to cancel this effect. Place a 100uF/330uF capacitor in parallel to the resistor RL and an additional 1 ohm resistor in the circuit. BJT Inverter Transistor has a lot of functions. The most common of them is its use as an amplifier. However, transistor can be used as a switch in a circuit i.e. as an inverter. The circuit for this experiment is shown below. For this experiment, it is recommended to use an external 5V DC supply like…

Continue ReadingElectronics Experiments with PSLab

SPI Communication in PSLab

PSLab supports communication using the Serial Peripheral Interface (SPI) protocol. The Desktop App as well as the Android App have the framework set-up to use this feature. SPI protocol is mainly used by a few sensors which can be connected to PSLab. For supporting SPI communication, the PSLab Communication library has a dedicated class defined for SPI. A brief overview of how SPI communication works and its advantages & limitations can be found here. The class dedicated for SPI communication with numerous methods defined in them. The methods required for a particular SPI sensor may differ slightly, however, in general most sensors utilise a certain common set of methods. The set of methods that are commonly used are listed below with their functions. In the setParameters method, the SPI parameters like Clock Polarity (CKP/CPOL), Clock Edge (CKE/CPHA), SPI modes (SMP) and other parameters like primary and secondary prescalar which are specific to the device used. Primary Prescaler (0,1,2,3) for 64MHz clock->(64:1,16:1,4:1,1:1) Secondary prescaler (0,1,..7)->(8:1,7:1,..1:1) The values of CKP/CPOL and CKE/CPHA needs to set using the following convention and according to our requirements. At CPOL=0 the base value of the clock is zero, i.e. the idle state is 0 and active state is 1. For CPHA=0, data is captured on the clock's rising edge (low→high transition) and data is changed at the falling edge (high→low transition). For CPHA=1, data is captured on the clock's falling edge (high→low transition) and data is changed at the rising edge (low→high transition). At CPOL=1 the base value of the clock is one (inversion of CPOL=0), i.e. the idle state is 1 and active state is 0. For CPHA=0, data is captured on the clock's falling edge (high→low transition) and data is changed at the rising edge (low→high transition). For CPHA=1, data is captured on the clock's rising edge (low→high transition) and data is changed at the falling edge (high→low transition). public void setParameters(int primaryPreScalar, int secondaryPreScalar, Integer CKE, Integer CKP, Integer SMP) throws IOException { if (CKE != null) this.CKE = CKE; if (CKP != null) this.CKP = CKP; if (SMP != null) this.SMP = SMP; packetHandler.sendByte(commandsProto.SPI_HEADER); packetHandler.sendByte(commandsProto.SET_SPI_PARAMETERS); packetHandler.sendByte(secondaryPreScalar | (primaryPreScalar << 3) | (this.CKE << 5) | (this.CKP << 6) | (this.SMP << 7)); packetHandler.getAcknowledgement(); }   The start method is responsible for sending the instruction to initiate the SPI communication and it takes the channel which will be used for communication as input. public void start(int channel) throws IOException { packetHandler.sendByte(commandsProto.SPI_HEADER); packetHandler.sendByte(commandsProto.START_SPI); packetHandler.sendByte(channel); }   The setCS method is responsible for selecting the slave with which the SPI communication has to be done. This feature of SPI communication is known as Chip Select (CS) or Slave Select (SS). A master can use multiple Chip/Slave Select pins for communication whereas a slave utilises just one pin as SPI is based on single master multiple slaves principle. The capacity of PSLab is limited to two slave devices at a time. public void setCS(String channel, int state) throws IOException { String[] chipSelect = new String[]{"CS1", "CS2"}; channel =…

Continue ReadingSPI Communication in PSLab

I2C Communication in PSLab

PSLab supports communication using the I2C protocol and both the Desktop App and the Android App have the framework set-up to use the I2C protocol. I2C protocol is mainly used by sensors which can be connected to PSLab. For supporting I2C communication, PSLab board has a separate block for I2C communication and has pins named 3.3V, GND, SCL and SDA. A brief overview of how I2C communication works and its advantages & limitations compared to SPI communication can be found here. The PSLab Python and Java communication libraries have a class dedicated for I2C communication with numerous methods defined in them. The methods required for a particular I2C sensor may differ, however, in general most sensors utilise a certain common set of methods. The set of methods that are commonly used are listed below with their functions. For utilising the methods, the I2C bus is first notified using the HEADER byte (it is common to all the methods) and then a byte to uniquely determine the method in use. The send method is used to send the data over the I2C bus. First the I2C bus is initialised and set to the correct slave address using I2C.start(address) followed by this method. The method takes the data to be sent as the argument. def send(self, data): try: self.H.__sendByte__(CP.I2C_HEADER) self.H.__sendByte__(CP.I2C_SEND) self.H.__sendByte__(data) # data byte return self.H.__get_ack__() >> 4 except Exception as ex: self.raiseException(ex, "Communication Error , Function : " + inspect.currentframe().f_code.co_name)   The read method reads a fixed number of bytes from the I2C slave. One can also use I2C.simpleRead(address,  numbytes) instead to read from the I2C slave. This method takes the length of the data to be read as argument.  It fetches length-1 bytes with acknowledge bits for each. def read(self, length): data = [] try: for a in range(length - 1): self.H.__sendByte__(CP.I2C_HEADER) self.H.__sendByte__(CP.I2C_READ_MORE) data.append(self.H.__getByte__()) self.H.__get_ack__() self.H.__sendByte__(CP.I2C_HEADER) self.H.__sendByte__(CP.I2C_READ_END) data.append(self.H.__getByte__()) self.H.__get_ack__() except Exception as ex: self.raiseException(ex, "Communication Error , Function : " + inspect.currentframe().f_code.co_name) return data   The readBulk method reads the data from the I2C slave. This takes the I2C slave device address, the address of the device from which the data is to be read and the length of the data to be read as argument and the returns the bytes read in the form of a list. def readBulk(self, device_address, register_address, bytes_to_read): try: self.H.__sendByte__(CP.I2C_HEADER) self.H.__sendByte__(CP.I2C_READ_BULK) self.H.__sendByte__(device_address) self.H.__sendByte__(register_address) self.H.__sendByte__(bytes_to_read) data = self.H.fd.read(bytes_to_read) self.H.__get_ack__() try: return [ord(a) for a in data] except: print('Transaction failed') return False except Exception as ex: self.raiseException(ex, "Communication Error , Function : " + inspect.currentframe().f_code.co_name)   The writeBulk method writes the data to the I2C slave. It takes address of the particular I2C slave for which the data is to be written and the data to be written as arguments. def writeBulk(self, device_address, bytestream): try: self.H.__sendByte__(CP.I2C_HEADER) self.H.__sendByte__(CP.I2C_WRITE_BULK) self.H.__sendByte__(device_address) self.H.__sendByte__(len(bytestream)) for a in bytestream: self.H.__sendByte__(a) self.H.__get_ack__() except Exception as ex: self.raiseException(ex, "Communication Error , Function : " + inspect.currentframe().f_code.co_name)   The scan method scans the I2C port for connected devices which utilise I2C as a communication mode. It takes…

Continue ReadingI2C Communication in PSLab

Real time Sensor Data Analysis on PSLab Android

PSLab device has the capacity to connect plug and play sensors through the I2C bus. The sensors are capable of providing data in real time. So, the PSLab Android App and the Desktop app need to have the feature to fetch real time sensor values and display the same in the user interface along with plotting the values on a simple graph. The UI was made following the guidelines of Google’s Material Design and incorporating some ideas from the Science Journal app. Cards are used for making each section of the UI. There are segregated sections for real time updates and plotting where the real time data can be visualised. A methods for fetching the data are run continuously in the background which receive the data from the sensor and then update the screen. The following section denotes a small portion of the UI responsible for displaying the data on the screen continuously and are quite simple enough. There are a number of TextViews which are being constantly updated on the screen. Their number depends on the type and volume of data sent by the sensor. <TextView android:layout_width="wrap_content" android:layout_height="30dp" android:layout_gravity="start" android:text="@string/ax" android:textAlignment="textStart" android:textColor="@color/black" android:textSize="@dimen/textsize_edittext" android:textStyle="bold" /> <TextView android:id="@+id/tv_sensor_mpu6050_ax" android:layout_width="wrap_content" android:layout_height="30dp" android:layout_gravity="start" android:textAlignment="textStart" android:textColor="@color/black" android:textSize="@dimen/textsize_edittext" android:textStyle="bold" />   The section here represents the portion of the UI responsible for displaying the graph. Like all other parts of the UI of PSLab Android, MPAndroidChart is being used here for plotting the graph. <LinearLayout android:layout_width="match_parent" android:layout_height="160dp" android:layout_marginTop="40dp"> <com.github.mikephil.charting.charts.LineChart android:id="@+id/chart_sensor_mpu6050" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#000" /> </LinearLayout>   Since the updates needs to continuous, a process should be continuously run for updating the display of the data and the graph. There are a variety of options available in Android in this regard like using a Timer on the UI thread and keep updating the data continuously, using ASyncTask to run a process in the background etc. The issue with the former is that since all the processes i.e. fetching the data and updating the textviews & graph will run on the UI thread, the UI will become laggy. So, the developer team chose to use ASyncTask and make all the processes run in the background so that the UI thread functions smoothly. A new class SensorDataFetch which extends AsyncTask is defined and its object is created in a runnable and the use of runnable ensures that the thread is run continuously till the time the fragment is used by the user. scienceLab = ScienceLabCommon.scienceLab; i2c = scienceLab.i2c; try { MPU6050 = new MPU6050(i2c); } catch (IOException e) { e.printStackTrace(); } Runnable runnable = new Runnable() { @Override public void run() { while (true) { if (scienceLab.isConnected()) { try { sensorDataFetch = new SensorDataFetch(); } catch (IOException e) { e.printStackTrace(); } sensorDataFetch.execute(); } } } }; new Thread(runnable).start();   The following is the code for the ASyncTask created. There are two methods defined here doInBackground and onPostExecute which are responsible for fetching the data and updating the display respectively. The raw data is fetched using the getRaw…

Continue ReadingReal time Sensor Data Analysis on PSLab Android

Integrating Travis CI and Codacy in PSLab Repositories

Continuous Integration Testing and Automated Code Review tools are really useful for developing better software, improving code and overall quality of the project. Continuous integration can help catch bugs by running tests automatically and to merge your code with confidence. While working on my GsoC-16 project, my mentors guided and helped me to integrate Travis CI and Codacy in PSLab github repositories. This blog post is all about integrating these tools in my github repos, problems faced, errors occurred and the test results. Travis CI is a hosted continuous integration and deployment system. It is used to build and test software projects hosted on github. There are two versions of it, travis-ci.com for private repositories, and travis-ci.org for public repositories. Read : Getting started with Travis CI Travis is configured with the “.travis.yml” file in your repository to tell Travis CI what to build. Following is the code from '.travis.yml' file in our PSLab repository. This repo contains python communication library for PSLab. language: python python:   - "2.6"   - "2.7"   - "3.2"   - "3.3"   - "3.4" # - "3.5" # command to install dependencies # install: "pip install -r requirements.txt" # command to run tests script: nosetests With this code everything worked out of the box (except few initial builds which errored because of missing 'requirements.txt' file) and build passed successfuly :) :) Later Mario Behling added integration to FOSSASIA Slack Channel. Slack notifications Travis CI supports notifying  Slack channels about build results. On Slack, set up a new Travis CI integration. Select a channel, and you’ll find the details to paste into your '.travis.yml'. Just copy and paste the settings, which already include the proper token and you’re done. The simplest configuration requires your account name and the token. notifications: slack: '<account>:<token>' notifications:   slack: fossasia:***tokenishidden**** Import errors in Travis builds of PSLab-apps Repository PSLab-apps repository contains PyQt bases apps for various experiments. The '.travis.yml' file mentioned above gave several module import errors. $ python --version Python 3.2.5 $ pip --version pip 6.0.7 from /home/travis/virtualenv/python3.2.5/lib/python3.2/site-packages (python 3.2) Could not locate requirements.txt. Override the install: key in your .travis.yml to install dependencies. 0.33s$ nosetests E ====================================================================== ERROR: Failure: ImportError (No module named sip) The repo is installable and PSLab was working fine on popular linux distributions without any errors. I was not able to find the reason for build errors. Even after adding proper 'requirements.txt' file,  travis builds errored. On exploring the documentation I could figure out the problem. Travis CI Environment uses separate virtualenv instances for each Python version. System Python is not used and should not be relied on. If you need to install Python packages, do it via pip and not apt. If you decide to use apt anyway, note that Python system packages only include Python 2.7 libraries (default python version). This means that the packages installed from the repositories are not available in other virtualenvs even if you use the –system-site-packages option. Therefore I was getting Import module errors. This…

Continue ReadingIntegrating Travis CI and Codacy in PSLab Repositories

Design Your Own Experiments With PSLab

PSLab, with its simple and open architecture allows programmers, hobbyists to use the tool for various measurements and to develop new experiments with simple python code. One of the main target group, the PSLab is aimed at, is high-school science teachers and students, who may or may-not be familiar with the computer programming. For such users it is difficult to design or develop new experiments on their own. They may also find it difficult to fetch the data and plot required graphs, if a ready-made GUI is not available for that particular experiment. To enable such users to quickly design a simple experiment for studying various phenomena, we have developed a simple Experiment Designer GUI. This incorporates few controls, read-back elements and easy functions to select parameters and plot graphs. The screen shot of the 'Design Your Own Experiment' GUI along with the App-window is here.. Experiment Designer allows the user to define the control and read-back sequences of parameters and execute them. Features of "Design Your Own Experiment" GUI Configure Experiment : Here user can select the required channels ( manual / sweep / read-back). One can also add a derived channel for measuring some physical quantity, for example 'current'. Make Measurements : Selected channels are displayed. User can make measurements individually for each step or  can sweep in auto mode. Plot and View Plots: Enables user to plot selected parameters. Acquired plots can be selectively displayed or deleted. Save Plots: Data acquired can be save in a spreadsheet. Save Profile : Experiment profile can be saved for repeating the experiment in future. Saved profiles can be loaded from "Load Profile" tab. Example : Diode IV Characteristics Experiment For this experiment one needs the following... A variable voltage source : Needs to be swept from Voltage A to  B (say from 0V to 5V) Current Monitoring : Needs to be read for every value of Voltage Plotting and analytics :  Tools to plot the parameters and save data Schematic Circuit diagram: CH3 monitors the voltage drop across the diode. PV1 is varied in steps, and for each step the current is calculated from the difference between voltages at PV1 and CH3, and the known value of the resistor. For example for 1K resistor, current through the diode is given by I = (PV1-CH3)/1K Procedure : Step 1. Connect Fossasia PSLab to the pc. Connect the components -  Diode from CH3 to Ground and  1k resistor from PV1 to CH3 Step 2. From the terminal Run Experiments The App-window will pop-up. Click on 'Design your own Experiment' button to get the experiment designer GUI. Step 3: Select channels Sweep Channel PV1 - Sweep from 0.00V -5.00V in 200 steps Read-back Channel CH3 - for monitoring voltage across the diode Derived Channel - To measure Current. Type the equation to calculate the current,   (PV1()-CH3())/1000 Step 4. Click on 'Prepare Experiment' to get measurements screen. Click on 'Evaluate All Rows' to make the measurements. Step 5. Select the required columns and click on…

Continue ReadingDesign Your Own Experiments With PSLab

PSLab Communication Function Calls

Prerequisite reading: .//communicating-with-pocket-science-lab-via-usb-and-capturing-and-plotting-sine-waves/ Interfacing with the hardware of PSLab, fetching the data and plotting it is very simple and straight forward. Various sensors can be connected to PSLab and data can be fetched with a simple python code as shown in the following example... >>> from PSL import sciencelab >>> I = sciencelab.connect() # Initializing: Returns None if device isn't found. The initialization process connects to tty device and loads calibration values. # An example function that measures voltage present at the specified analog input >>> print I.get_average_voltage('CH1') # An example to capture and plot data >>> I.set_gain('CH1', 3) # set input CH1 to +/-4V range >>> I.set_sine1(1000) # generate 1kHz sine wave on output W1 >>> x,y = I.capture1('CH1', 1000, 10) # digitize CH1 1000 times, with 10 usec interval >>> plot(x,y) >>> show() # An example function to get data from magnetometer sensor connected to PSLab >>> from PSL.SENSORS import HMC5883L #A 3-axis magnetometer >>> M = HMC5883L.connect() >>> Gx,Gy,Gz = M.getRaw() The module sciencelab.py contains all the functions required for communicating with PSLab hardware. It also contains some utility functions. The class ScienceLab() contains methods that can be used to interact with the PSLab. After initiating this class, all the features built into the device can be accessed  using various function calls. Capture1 : for capturing one trace capture1(ch, ns, tg) Arguments ch  : Channel to select as input. ['CH1'..'CH3','SEN'] ns  :  Number of samples to fetch. Maximum 10000 tg   :  Time gap between samples in microseconds #Example >>> x,y = I.capture1('CH1', 1000, 10) # digitize CH1 1000 times, with 10 usec interval Returns : Arrays X(timestamps),Y(Corresponding Voltage values) Capture2 : for capturing two traces capture2(ns, tg, TraceOneRemap='CH1') Arguments ns :  Number of samples to fetch. Maximum 5000 tg  :  Time gap between samples in microseconds TraceOneRemap :   Choose the analogue input for channel 1 (Like MIC OR SEN). It is connected to CH1 by default. Channel 2 always reads CH2. #Example >>> x,y1,y2 = I.capture2(1600,1.75,'CH1') # digitize CH1 and CH2, 1600 times, with 1.75 usec interval Returns: Arrays X(timestamps),Y1(Voltage at CH1),Y2(Voltage at CH2) Capture4 : for capturing four taces capture4(ns, tg, TraceOneRemap='CH1') Arguments ns:   Number of samples to fetch. Maximum 2500 tg :   Time gap between samples in microseconds. Minimum 1.75uS TraceOneRemap :   Choose the analogue input for channel 1 (Like MIC OR SEN). It is connected to CH1 by default. Channel 2 always reads CH2, channel 3 always reads CH3 and MIC is channel 4 (CH4) #Example >>> x,y1,y2,y3,y4 = I.capture4(800,1.75) # digitize CH1-CH4, 800 times, with 1.75 usec interval Returns: Arrays X(timestamps),Y1(Voltage at CH1),Y2(Voltage at CH2),Y3(Voltage at CH3),Y4(Voltage at CH4) Capture_multiple : for capturing multiple traces capture_multiple(samples, tg, *args) Arguments samples:   Number of samples to fetch. Maximum 10000/(total specified channels) tg :   Time gap between samples in microseconds. *args :   channel names # Example >>> from pylab import * >>> I=interface.Interface() >>> x,y1,y2,y3,y4 = I.capture_multiple(800,1.75,'CH1','CH2','MIC','SEN') >>> plot(x,y1) >>> plot(x,y2) >>> plot(x,y3) >>> plot(x,y4) >>> show() Returns: Arrays X(timestamps),Y1,Y2 ... Capture_fullspeed :…

Continue ReadingPSLab Communication Function Calls

Communicating with Pocket Science Lab via USB and capturing and plotting sine waves

Design of PSLab combines the flexibility of Python programming language and the real-time measurement capability of micro-controllers. PSLab, with its simple and open architecture allows users to use the tool for various measurements and to develop new experiments with simple functions written in python. PSLab is interfaced and powered by USB port of the computer. For connecting external signals it has several input/output terminals as shown in the figure. Interfacing with the real world Connecting to PSLab is as simple and straight forward as this... >>> from PSL import sciencelab >>> I = sciencelab.connect() #Returns None if device isn't found # An example function that measures voltage present at the specified analog input >>> print I.get_average_voltage('CH1') Various sensors can be connected to PSLab and data can be fetched with a simple python code as shown below... >>> from PSL.SENSORS import HMC5883L #A 3-axis magnetometer >>> M = HMC5883L.connect() >>> Gx,Gy,Gz = M.getRaw() The module sciencelab.py contains all the functions required for communicating with PSLab hardware. It also contains some utility functions. The class ScienceLab() contains methods that can be used to interact with the PSLab. The connect() function returns an object of this class if PSLab hardware is detected. The initialization process does the following * connects to tty device * loads calibration values. >>> from PSL import sciencelab >>> I = sciencelab.connect() >>> print I <PSL.sciencelab.ScienceLab instance at 0x7fe9a7bf0e18> After initiating this class, its various function calls will allow access to all the features built into the device. Some examples showing the use of few function calls are given below... Example 1: Capturing and plotting a sine wave The function call used, capture1(self,ch,ns,tg,*args,**kwargs) Arguments ch  : Channel to select as input. ['CH1'..'CH3','SEN'] ns  :  Number of samples to fetch. Maximum 10000 tg   :  Time gap between samples in microseconds Example Program Connect WG1 to CH1 and run the following code. >>> from pylab import * >>> from PSL import sciencelab >>> I=sciencelab.connect() >>> I.set_gain('CH1', 3) # set input CH1 to +/-4V range >>> I.set_sine1(1000) # generate 1kHz sine wave on output W1 >>> x,y = I.capture1('CH1', 1000, 10) # digitize CH1 1000 times, with 10 usec interval >>> plot(x,y) >>> show() For running the script in IDE, one should define source code encoding, add this to the top of your script: # -*- coding: utf-8 -*- The output of the program is here... Example 2 : Capturing two sine waves and plotting The function call used, capture2(self,ns,tg,TraceOneRemap='CH1') Arguments ns :  Number of samples to fetch. Maximum 5000 tg  :  Time gap between samples in microseconds TraceOneRemap :   Choose the analogue input for channel 1 (Like MIC OR SEN). It is connected to CH1 by default. Channel 2 always reads CH2. Example Program Connect WG1 to CH1, WG2 to CH2 and run the following code. # -*- coding: utf-8 -*- from pylab import * from PSL import sciencelab I=sciencelab.connect() I.set_gain('CH1', 2) # set input CH1 to +/-4V range I.set_gain('CH2', 3) # set input CH2 to +/-4V range I.set_sine1(1000) #…

Continue ReadingCommunicating with Pocket Science Lab via USB and capturing and plotting sine waves

Features and Controls of Pocket Science Lab

Prerequisite reading: .//pslab-code-repository-and-installation/ PSLab is equipped with array of useful control and measurement tools. This tiny but powerful Pocket Science Lab enables you to perform various experiments and study a wide range of phenomena. Some of the important applications of PSLab include a 4-channel oscilloscope, sine/triangle/square waveform generators, a frequency counter, a logic analyser and also several programmable current and voltage sources. Add-on boards, both wired as well as wireless(NRF+MCU), enable measurement of physical parameters ranging from acceleration and angular velocity, to luminous intensity and Passive Infra-red. (Work under progress...) As a reference for digital instruments a 12-MHz Crystal is chosen and a 3.3V voltage regulator is chosen for the analogue instruments. The device is then calibrated against professional instruments in order to squeeze out maximum performance. Python based communication library and experiment specific PyQt4 based GUI's make PSLab a must have tool for programmers, hobbyists, science and engineering teachers and also students. PSLab is interfaced and powered by USB port of the computer. For connecting external signals it has several input/output terminals as shown in the figure. Feature list for the acquisition and control : The most important feature of PSLab is a 4-channel oscilloscope which can monitor analog inputs at maximum of 2 million samples per second. Includes the usual controls such as triggering, and gain selection. Uses Python-Scipy for curve fitting.     Waveform Generators W1 : 5Hz - 5KHz arbitrary waveform generator. Manual amplitude control up to +/-3Volts W2 : 5Hz - 5KHz arbitrary waveform generator. Amplitude of +/-3Volts. Attenuable via software PWM : There are four phase correlated PWM outputs with maximum frequency 32MHz, 15nano second duty cycle, and phase difference control. Measurement Functions Frequency counter tested up to 16 MHz. Capacitance Measurement. pF to uF range PSLab has several 12-bit Analog inputs (function as voltmeters) with programmable gains, and maximum ranges varying from +/-5mV to +/-16V. Voltage and Current Sources 12-bit Constant Current source. Maximum current 3.3mA [subject to load resistance]. PSLab has three 12-bit Programmable voltage sources/ +/-3.3V,+/-5V,0-3V . (PV1, PV2, PV3) Other useful tools 4MHz, 4-channel Logic analyzer with 15nS resolution.Voltage and Current Sources SPI,I2C,UART outputs that can be configured and controlled entirely through Python functions. (Work in progress...) On-board 2.4GHz transceiver for wireless data acquisition. (Work in progress..) Graphical Interfaces for Oscilloscope, Logic Analyser, streaming data, wireless acquisition, and several experiments developed that use a common framework which drastically reduces code required to incorporate control and plotting widgets. PSLab also has space for an ESP-12 module for WiFi access with access point / station mode. Screen-shots of GUI apps. With all these features PSLab is taking a good shape and I see it as a potential tool that can change the way we teach and learn science. :) :)  

Continue ReadingFeatures and Controls of Pocket Science Lab

A low-cost laboratory for everyone: Sensor Plug-ins for ExpEYES to measure temperature, pressure, humidity, wind speed, acceleration, tilt angle and magnetic field

Working on ExpEYES in the last few months has been an amazing journey and I am gratful of the support of Mario Behling, Hong Phuc Dang and Andre Rebentisch at FOSSASIA. I had a lot of learning adventures with experimenting and exploring with new ideas to build sensor plug-ins for ExpEYES. There were some moments which were disappointing and there were some other moments which brought the joy of creating sensor plug-ins, add-on devices and GUI improvements for ExpEYES.My GSoC Gallery of Sensors and Devices: Here are all the sensors I played with for PSLab..The complete list of sensor plug-ins developed is available at http://gnovi.edublogs.org/2015/08/21/gsoc-2015-with-fossasia-list-of-sensor-plug-ins-developed-for-expeyes/Sensor Plugins for ExpEYES The aim of my project is to develop new Sensor Plug-ins for ExpEYES to measure a variety of parameters like temperature, pressure, humidity, wind speed, acceleration, tilt angle, magnetic field etc. and to provide low-cost open source laboratory equipment for students and citizien scientists all over the world.We are enhancing the scope of ExpEYES for using it to perform several new experiments. Developing a low-cost stand alone data acquisition system that can be used for weather monitoring or environmental studies is another objective of our project.I am happy to see that the things have taken good shape with additional gas sensors added which were not included in the initial plan and we have almost achieved all the objectives of the project, except for some difficulties in calibrating sensor outputs and documentation. This issue will be solved in a couple of days.Experimenting with different sensors in my kitchen laboratoryI started exploring and experimenting with different sensors. After doing preliminary studies I procured analog and a few digital sensors for measuring weather parameters like temperature, relative humidity and barometric pressure. A few other sensors like low cost piezoelectric sensor, accelerometer ADXL-335, Hall effect magnetic sensor, Gyro-module etc were also added to my kitchen laboratory. We then decided to add gas sensors for detecting Carbon Monoxide, LPG and Methane.With this development ExpEYES can now be used for pollution monitoring and also in safety systems in Physics/chemistry laboratory. The work on the low-cost Dust Sensor is under progress. Challenges, Data Sheet, GUI programsI had to spend a lot of time in getting the sensor components, studying their data sheets, soldering and setting them up with ExpEYES. And then little time in writing GUI Programs. I started working almost 8 to 10 hours every evening after college hours (sometimes whole night) and now things have taken good shape.Thanks to my mentor at FOSSASIA for pushing me, sometimes with strict words. I could add many new sensor plug-ins to ExpEYES and now I will also be working on Light sensors so that the Pocket Science Lab can be used in optics. With these new sensor plug-ins one can replace many costly devices from Physics, Chemistry, Biology and also Geology Lab.What's next? My Plan for next steps Calibration of sensor data Prototyping stand-alone weather station Pushing data to Loklak server Work on PSLab@Fossasia website Fossasia Live Cd based on Lubuntu with ExpEYES and other…

Continue ReadingA low-cost laboratory for everyone: Sensor Plug-ins for ExpEYES to measure temperature, pressure, humidity, wind speed, acceleration, tilt angle and magnetic field