Jun 08 2018
PMS Poor Man Scope 3 again
come from myBLOG Flask webserverthe last article about
Poor Man Scope
as version PMS 3.4 see here is from 7/2015,it has a arduino code with serial menu interface:
operated manually ( just use the IDE monitor or other serial terminal // a Line Chart show is included )
or by processing tools on PC and RPI
or latest version, python2 tools for collecting the data and send the operation,
with a add python2 // python-matplotlib tool ( 3 channel scope ) for the show.
? about time to bring it to the WEB?
but if possibly with unchanged arduino code ( if it still runs from newest IDE. )
that must be the first test, to setup the old thing as it is
using PMS34.tar.xz//sketchbook/arduino/PMS34 ( what ( old MAX32 IDE) still has .pde files )
once you press the Arduino IDE [save] button all files are renamed to .ino
+ copy arduino code to this sketchbook
connecting a Arduino LEONARDO and upload
** UNO and Leonardo switch to PMS2 ( 2 channel scope ) 360 samples by compiler switch
#define usePROCESSING
// or PMS3 channel Line Chart 36 samples, due to memory restrictions
for test use jumper 3v3 to A0, 5v to A1, ( 3d channel anyway ="0" (on UNO))

and with type "-" 4 times switch again from 2 channel (max 21kHz) to one channel (A0) but with 35kHz.
( and yes, board MEGA, DUE, MAX32 are much faster ( MAX32 one channel 500kHz ) )
++ check python2 service to catch the data.
i needed to change 2 lines about the serial open but then the old tool runs


-- check old visualization tool //
need run ( twice )
sudo pip install matplotlib

but stilll not get a graph window.

ok, just forget about that
start service ( old but changed for python3 and TAB cleaned) manually:
./start_pms3_service
that creates ( like a ringbuffer ) 10 CSV files at RAM DISK ( about one every 1.6sec. ) ( and a pointer to the newest )
the FLASK web page get the newest:
+++ new flask page to show the data and operation.

with '-' button select a higher sample rate
but must wait auto update ( 10sec in HTML header) / or / press the browser update button
and when i disconnect A0 from 3v3 and hold the wire end with 2 fingers see:

ok, call it a function check / far from a calibration / but lets do some math:
if we sample with the indicated 10100Hz and see a 50Hz noise from my environment / body
one sinus would be 202 samples, we see 360 samples of it, so we should see: 1.78 sinus? hmmm, could be
now using Arduino UNO / Leonardo / NANO you get a PMS2 only,
so lets try some other hardware
+ + with more memory can do PMS3
+ + with faster cpu can do higher sample rate
there is a other arduino sketch you can find
that i loaded in the above used Leonardo, ( what now is not the SCOPE, its a signal generator only )
connected the Dout 6,9,10 to A2, A0,A1 via a voltage divider to a chipkit MAX32
( sorry i not check on IDE.. code is still loaded )
change serial port in pms3_arduino_stream.py from ttyACM0 to ttyUSB0
and connected the MAX32 to RPI
i do get a small com error? ( short / empty line)

default start scope rate for MAX32 is at 9kHz, but with 62kHz i see this
( note the PWM base frequenzy channel 2 and 3 // digging Arduino forum i not get a clear answer )

and with 522kHz only channel A0, where you clearly see that signal ON OFF in main loop of Arduino Leonardo is sometimes interrupted by the PWM timer for the other 2 channels

pls do some homework and find out if that frequenzy is indicated correctly.
my setup for this:

i found there is now a tone lib for arduino, so make a new testsketch
( and also revised the PMS sketch for work better in local modus ( IDE monitor Line Chart ) )
still UNO has more memory problems with the array [360,2] as the Leonardo
( below 500B warning by compiler )

so what we see here is a 1000Hz tone by the arduino UNO
and a fast switching signal on a second channel for testing faster boards
( on a different powersupply ?4.8V? // 3 wires (D8 /D9 /GND)to(A1 /A0 /GND) needed )
catched by a PMS3 Leonardo what thinks it samples 2 channels at 21.1kHz:
and we see 17 cycles of this 1kHz signal in 360 samples, perfect
- - still: running a UNO against a Leonardo
and manually counting cycles is not much of a calibration. - -
add see the new SCOPE background with DIV lines what fit to 5V arduino ( without pre divider ) and reduced resolution 1023 ADC to 250 scope pix
( so scope zoom possible but not provided )
that is a static variable in the
should have a zoom button for the amplitude / spec. for the PMS3 in chipkit max32.
play with BETTER SINUS
for a easy scope by RPI and Arduino see also here