Objective
This is an example of how to use JavaScript and WebSockets to create an online oscilloscope.
- The PIC32MZ2048EFH144 on the Ethernet Starter Kit is acting as a web server.
- In the 512 kB MPFS file system of the PIC32 Flash memory, all JavaScript libraries used (~250 kB), are stored compressed.
- The software is based on the MPLAB® Harmony 1.07.01 TCPIP example project "web_net_server_nvm_mpfs".
- The ADC channel 4 is set up to sample at 2 MHz and 12-bit. Every 100 ms, a measurement is triggered and the DMA collects 1024 sample values in an array.
- In the array, a trigger condition is searched to get a stable image.
- From the trigger condition, 100 samples are sent to the web browser (client) which displays the value.
Below are the necessary connections:
You have direct command line access in a terminal window.
Use a signal generator to apply a signal to pin 15 (RB4/AN4).
Enter the URL, 192.168.100.115, into a web browser (as long as it is connected directly).
Click on Realtime Websocket Stream.
Enter the correct IP address, and click on Connect.
You should see the signal measured at RB4/AN4 on pin 15 of the board header.
Note that when you compare it with a real scope, it looks very much the same.
Materials
Hardware Tools (Optional)
Tool | About | Purchase |
---|---|---|
| |
Software Tools
Tool | About | Installers |
Installation
Instructions |
||
---|---|---|---|---|---|
Windows | Linux | Mac OSX | |||
MPLAB® X
Integrated Development Environment |
| | | | |
MPLAB® XC32
C/C++ Compiler |
| | | | |
MPLAB® Harmony 1.xx
Integrated Software Framework |
| | | | |
Exercise Files
File | Download |
Installation
Instructions |
||
---|---|---|---|---|
Windows | Linux | Mac OSX | ||
Project and Source Files
|
| | | |
Procedure
There are two ways to connect the Ethernet Starter Kit (ESKT):
1
Connect to a network switch. The board will attempt to obtain an IP from a DHCP server.
Find the IP adress with the tcpip_discoverer.jar utility from:
c:\microchip\harmony\v1_07_01\utilities\tcpip_discoverer\.
2
Connect the ESKT directly to a PC and set the PC to a fixed IP adress, for example, 192.168.100.120.