Transform a RPICT into a web scope
This is to show the waveform on a web browser using the RPICT in a special configuration. We will use the Raspberrypi to collect the analog data from the RPICT and serve them as a HTTP server.
IMPORTANT. This is not a substitute for a scope. This is just a playground for demonstration.
Make sure you have a fresh Raspbian image installed.
Setup the Raspbian to enable the serial port. See the guide below to complete this. Howto setup Raspbian for serial read
Upload the Sketch
The RPICT will require a different sketch depending on the model. Download the appropriate sketch that applies.
RPICT7V1 RPICT4V3 RPICT8
Prepare the Raspberrypi for uploading new firmwares. Follow the instructions in the guide below.
Get the scope sketch.
Upload it to the RPICT unit.
For monitoring a slave card use this sketch instead (replace above as required).
Read The data
On the web browser
Setup the web server
Navigate to the http public folder and install the scope webserver.
sudo wget lechacal.com/RPICT/scope/rpict-scope-v2.0.zip
sudo unzip rpict-scope-v2.0.zip
This will create a folder called scope. There is a configuration file inside called rpict-scope.conf which should not need modification.
Now start a server instance
python3 -m http.server 8000
Run the service and view the data
From the raspberrypi run the command below. You might have to open a second terminal window for this.
Then now open a web browser and go to address
In the above address change 'raspberrypi' accordingly to your raspberrypi hostname or ip address.
Modify yrange in the address as required.
Get the data from serial port
You can read the data directly with the lcl-run command.
The out put format is N:d0,d1,d2,d3....dn
Where N is the channel number. d0 d1 d2 dn are the raw data points.
A simple python script to read the data would look like this below:
ser = serial.Serial('/dev/ttyAMA0', 38400)
# Read one line from the serial buffer
line = ser.readline().decode().strip()
# Create an array of the data
z = line.split(':')
channel = z
data = z.split(',')
This above can be run directly with