Jul 06 2015
i had a PMS3 project: Poor Man Scope with 3 Channel,
it is working on a variety of hardware,
-- sampling: arduino UNO, DUE or MAX32
-- visualization: PC or RPI ( HDMI or headless via PC )
-- software: processing or python ( for PC and RPI )
my last BLOG about scope was here and here and here and here and here and here and here and also some old versions at download area ( or just as link to zip file from inside the blog).
here in my BLOG i have that so called CATEGORIES: "arduino", raspberry pi", and even "processing", and also in my entry page "news" WORK BLOG i have 2 sections: "arduino" and " raspberry pi". all that structure not makes sense any more. poorly this old CMS php-fusion 7.2.7 does not support tags. UPS there is a addon i have to test
and so my documentation and software / downloads about that also very confusing, because historically grown.
but that it is what it is about, with the new faster RPI2B i could test processing again for visualization, even on the sampler hardware side no news.
as i tested MAX32 , but it is a 3v3 board so needs a voltage divider at the Ains to be used for the 5V world or even bigger voltages ( also DUE board).
and it even needs a different USB cable,
also it needs a different ( modified arduino 0023 ) IDE, but now also for raspberry pi available!
on PC from here download/update with "mpide-0023-windows-20140821.zip" 220MB
upload project: PMS33 (MAXcopy) ok
in line chart mode test: one channel 513kHz, 3 channel 65kHz
here i have the IDE 1.6.5 nightly called "1.6.6 hourly build" from here
upload project PMS33 (UNOcopy see //#define usePROCESSING ) ok as "3 channel line chart" on UNO
no ram for 3 channel 360 samples..to processing scope, but 38 samples for one page line chart good.
you see the 38 lines plus one info line in IDE monitor,
with [+] or [-] can adjust sample rate from 1 channel 35kHz , 3 channel 14kHz .. 24Hz,
and in NO BATCH mode ( line by line analog read and print mode ) down to 30sec sample rate.
above use 1.3kHz ( 38 samples in 28msec batch ) and a open wire at Ain0 touch by hand as antenna for stray 50Hz. you see 26 samples is one sinus, 1315HZ/26=50Hz
when i made that PMS3 code i learned that UNO is to small for the 360samples / 3 channel int array
so i use the "no use processing" thinking means only show 38samples / 3 channel int array for line chart.
implicit i wanted to say: if you use a UNO and the processing "scope" visualization, better use PMS2 only.
now with this release ( PMS34 ) i think i could make a automatic compiler switch to solve this.
first i had to dismantle my DUE process control system, then
download IDE 1.6.5 r2 (146MB) for test with DUE ( 1.6.5 nightly has no DUE )
again not see DUE board, use BOARD MANAGER, load arduino SAM board ( slow downloading of 85MB more )
first using line chart ( //#define usePROCESSING ) again and see 76kHz 3 channel and
655kHz 1 channel ( but then can not change sample rate / screen freeze at next operation )
have to check on update reg. "STIMMER", anyhow close/open terminal resets DUE
but that would make DUE the fastest board.
all 3 boards and software IDEs parallel.
the 3 code projects are ( should be ) same besides some compiler switches "//"
and the MPIDE *.pde naming requirement
as i already make small changes make it a PMS34 ( 3 channel, revision 4 )
update onWin7 PC: from here i download/update "processing-2.2.1-windows32.zip" 115 MB
load PMS33 / make PMS34 / run. As MAX32 (COM10) and Arduino Due (COM12) running
the "Serial.list()" connected me to MAX32. Now i want to show you a nice picture so get one more board ( Arduino MICRO PRO ) to make me a signal
here i move from PC to RPI2B
but first install on RPI2B WHEEZY the new processing:
i last time use processing-2.1-linux32 and did not get the serial interface running, now i follow here to use newer version, still the actual would be this
try the newer version first:
sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get install oracle-java7-jdk 70MB
sudo update-alternatives --config java 0 auto jdk8, 1 manual jdk7, 2 manual jdk 8: i select 1???
wget http://download.processing.org/processing-2.2.1-linux32.tgz 98MB
tar xvzf processing-2.2.1-linux32.tgz
rm -rf ~/processing-2.2.1/java
ln -s /usr/lib/jvm/jdk-7-oracle-armhf ~/processing-2.2.1/java
wget https://java-simple-serial-connector.googlecode.com/files/jSSC-2.6.0-Release.zip 276kB
mv jSSC-2.6.0-Release/jssc.jar ~/processing-2.2.1/modes/java/libraries/serial/library/
(remove the jSSC folder: rm -r jSSC-2.6.0-Release )
runtest, no serial ...
now as long processing 2xx use JDK7 and not JDK8 hardfloat the improvement could be only by the RPI2B speed. with processing 3 all will be better?? update here
try to run the project but can not find its libraries??
my processing preferences sketchbook points to /home/pi/sketchbook/processing/
and there in /libraries/ i put: Arduino.jar, arduinoscope.jar, controlP5.jar
prior it worked ( and still under windows with same 2.2.1 version ) with that libraries inside a /code/ subdir with the project.
hmm, a version problem? see here
still error cc.arduino not found, that is about the linux name problem:
rename the "new" /home/pi/yoursketchbook/libraries/arduino/library/Arduino.jar to arduino.jar, now load ok
for arduino have the IDE 1.6.5 for raspberry MAX32 MPIDE need
wget https://chipkit.s3.amazonaws.com/builds/mpide-0023-raspberrypi-20140821.tgz 242MB
tar xvzf /home/pi/mpide-0023-raspberrypi-20140821.tgz
yes better would be under /usr/share/ where also arduino IDE is.
here even a 1.5.0 version available??
anyhow now follow this:
sudo apt-get install gcc-avr ( should be there for arduino already exists_OK )
sudo apt-get install librxtx-java i remember, that's the bad one exists_OK
Add the following lines to your .profile: ... // can also be part of start like with arduino
see sudo cat /usr/bin/arduino
Disable console on serial port on RPi? // should not be needed
hard link named /dev/ttyS0 to /dev/ttyAMA0 and start by ./mpide // could be done like arduino start
here is what i try:
sudo cp arduino.desktop mpide.desktop
sudo nano mpide.desktop
name MPIDE0023 , exec mpide0023
sudo cp arduino mpide0023
sudo nano mpide0023
... that code you will find in download pack later
so, MPIDE start via desktop menu,
but intro picture missing, version info missing, port grey,
when i start ./mpide manually add see a warning:
RXTX Version mismatch jar: 2.1.-7, lib: 2.2pre2
just to be sure i do the 3 additional hevangel things
3. sudo ln -s /dev/ttyUSB0 /dev/ttyACM0
4. sudo usermod -a -G dialout pi
5. sudo usermod -a -G tty pi
anyhow copy in my PMS34 sketch from MPIDE of PC and open in RPI MPIDE
port see /dev/ttyUSB0 select
verify, upload, monitor OK
run PMS3 on RPI2B / wheezy / processing 2.2.1 / by MAX32 PMS3 scope and a "Arduino micro pro" testsignal
after change port in processing sketch list it runs. but it seems to be an old code, need the update with the zoom buttons / copy PMS43 from PC OK
and for channel 2 and 3 have signal problem, even i have no idea what could be different now from the last PC setup? USB HUB? ( a additional GND wire MAX32 Arduino MICRO PRO not helped )
but download SAME CODE via MPIDE from PC to MAX32 back to RPI
now after copy new MPIDE code from PC to RPI again and copy it to arduino sketchbook
at compiler ( verify) start the .pde are renamed to .ino ( not by IDE 1.0.1 ??)
running Arduino 1.6.5 on RPI i need again first use board manager to be able to use DUE
but compile give error
test the UNO with the new compiler switch ( back to 2 channel ) worked in chart line and processing
but could not close scope window, so try again that prepared switch
#define useRPI what slows serial com down for RPI. ( same baud rate but delays in sending // that needs tuning) use
anyhow UNO 2 channel trick works now
detailed system layout:
i have to get the PYTHON tools ( as processing replacement ) also running again, see here
and its autostart
first on PC
starting the arduino_stream_PMS3.py from python IDE 2.7.6
and adjust COM10, i see warnings about "TOO SHORT LINE" ( seems to be between info line and first data set?? need check arduino code )
and a batch CSV write of 10 files ( 1 info line , 360 data lines) to C/temp ( about every 1.4sec )
starting it with double click execute it directly in python.exe and start the scope by python IDE,
now i want to make PC and RPI version same by detecting OS.
here after copy to RPI the stream run by python2 IDE for diagnostic
but you can also just start it from terminal by
after do the auto start thing on the service ( see file and info )
After you have the matplot lib installed
sudo apt-get install python-matplotlib
you can start the scope from terminal
or by the new desktop icon.
what i see after first start was that i get every 1.4sec a new dataset from arduino (due)
to a csv file in RAM_DISK, but the scope shows [conti] mode, only every 2nd,
? because of this? timer = fig.canvas.new_timer(interval=2000) # 2 sec
so, with the new and faster RPI2 have to check on all timing on arduino and RPI side.
ok, displayupdate 1sec (1000) ok, read every file now.
somewhere on the way to here i lost my arduino micro pro
when i connect it to any computer i not see a USB device ( as it was a leonardo i should see even 2 )
if i burn it by breadboard wiring or if it is possible that i killed it by a broken upload ??
for operation pls find 2 desktop files:
one for stop/start/restart/ or check the service
one for starting the scope.
code or load it from RPI with
for the service i work on the operation from desktop,
because if you make it autostart / at boot /
but later need to change the arduino ( arduino IDE .. ) the port is blocked by the service,
you need to stop it first, that operation is possible by click on a icon.
for a little framework only about that autostart and operation pls see here
i work from remote ( headless / remote desktop program (xrdp installed))
and i see a problem that the RPI2 desktop sometimes can not be operated,
spec. the scope window can not be closed. ( but screen not frozen / see data update... )
but on headerline "program" right click "close window" works
but when i close and reopen the RDP window, the operation (closing the windows ) is possible again.
could be a problem with the PC RDP.