Welcome to Laser Pointer Forums - discuss green laser pointers, blue laser pointers, and all types of lasers

Thanks for supporting LPF!

Avery's Instagram | Open Source Cybersecurity Software by Avery | Considering selling LPF, DM if interested

Peregrine - The Free, Open Source LPM Interface

Speedy78

New member
Joined
Dec 17, 2012
Messages
2,081
Points
0
I looked at some of it but I have no idea what any of it is haha.
 
  • Like
Reactions: ARG



mhemling33

Active member
Joined
Oct 19, 2012
Messages
983
Points
43
What do you use to edit it on a Mac ? I am downloading xforce but I am not sure if that's the right program.

You can probably guess from the statement above I have no idea what I an doing but I would like to play around and try to learn.
 
  • Like
Reactions: ARG

Atomicrox

Well-known member
Joined
Jun 22, 2011
Messages
2,431
Points
83
I'm going to attempt to make some changes to the source but I've never used Processing before.

I've just downloaded Processing 2.0b8, unzipped it and tried to run Peregrine. Got a missing ControlP5 library so I installed that from within Processing. Now I'm getting

Code:
ControlP5 2.0.4 infos, comments, questions at http://www.sojamo.de/libraries/controlP5
Exception in thread "Animation Thread" java.lang.NullPointerException
	at processing.core.PApplet.handleDraw(PApplet.java:2297)
	at processing.core.PGraphicsJava2D.requestDraw(PGraphicsJava2D.java:243)
	at processing.core.PApplet.run(PApplet.java:2140)
	at java.lang.Thread.run(Thread.java:662)
Exception in thread "Animation Thread" java.lang.NullPointerException
	at processing.core.PApplet.handleDraw(PApplet.java:2297)
	at processing.core.PGraphicsJava2D.requestDraw(PGraphicsJava2D.java:243)
	at processing.core.PApplet.run(PApplet.java:2140)
	at java.lang.Thread.run(Thread.java:662)
Stable Library
=========================================
Native lib Version = RXTX-2.1-7
Java lib Version   = RXTX-2.1-7

The main window looks fine but the Serial Console looks empty. The .exe works fine. I'm on Win7 x86, BTW.


Edit: strangely it does work properly with Processing 2.0b7. Go figure...
 
Last edited:

Atomicrox

Well-known member
Joined
Jun 22, 2011
Messages
2,431
Points
83
Sorry for the double post but I think this is worth it.

Here's my first contribution, IMHO an improvement to the autorange algorithm.

The old one went like (in mW): 50, 100, 200, 300, ..., 900, 1000, 1500, 2000 and continued in increments of 500.

Mine goes: 1, 2, 3, ..., 9, 10, 20, 30, ..., 90, 100, 200, 300, ..., 900, 1000, 2000, 3000, ..., 9000, 10000, 20000 and so on.
It has a higher dynamic range and IMHO adapts better to very small and very big measurements. I placed a lower limit of 1mW because all Peregrine readings show with only one decimal.

I also thought abut using an osciloscope-like scale: 1, 2, 5, 10, 20, 50, 100, 200, 500, 1000, 2000, 5000, 10000, 20000 and so on. What do you guys think?

Heres the code, just substitute lines 69 to 74 of Graph.pde with:
Code:
if(maxData <= 1)
  {
    maximum = 1.0;
  }
  else
  {
    float magnitude = pow(10, floor(log(maxData) / 2.3025850929940456840179914546844));
    maximum = ceil(maxData / magnitude) * magnitude;
  }

Feel free to include this in the next version if you like it, Trevor!


Here are some suggestions:
-Unify Monitor and "regular" measurements - this could be done by adding a few more measurement settings:
--When available time is reached (combo box):
---stop (like "regular" measurements)
---roll window (like monitor does)
---increase total time (let's say it was set at 60s and you get one reading per second - after the graph border is hit every second extends the total time by one second and resizes it) (this would be very nice for long measurements without a foreseable end)
--Separate total time and time scale. Then you could make the graph show 5min or 300s, depending on your preferences.
--Add filtering options, to help remove noise:
---Amount of samples
---Supersampling/moving average selector

-Add restart button: stops the measurement, clears the graph and starts a new one with the same settings.
-Move stop from the menu to a button.
-Replace Measurement/New... with Measurement/Settings... or something. That way it won't restart until you click the restart button.
-Move port selection under the meter menu, refreshing automatically when the meter menu is opened. Leave only connect as a button.
-Move status bar to the bottom and buttons either to the top below the menus or to the bottom above the status bar.
-Make menus behave as standard menus:
--Remove "gaps"
--Top level menus only opens when clicked
--Only one menu is open at a time
--Menus only close when you click outside

-Add software zeroing:
--A zero button, when clicked it takes a few readings, computes average (or maybe minimum) and from that point forward subtracts that from all readings.
--A raw button, which removes the software zeroing.
--A fourth panel beside Current Reading/Peak/Average, which shows the current Zero. This is needed to avoid people faking readings.
--Maybe a settings menu, with the amount of readings to use for zeroing and a selector for average or minimum.

Please don't take this huge list of suggestions wrong, Peregrine is absolutely wonderful as it is! I just think the interface could be more "standard" and intuitive with some changes.


I might try to implement some of these but I don't know anything about Processing and may not be able to do much, interface wise.
 

LtKernelPanic

Well-known member
Joined
Sep 22, 2010
Messages
1,357
Points
48
Re: Peregrine - The Free LPM Interface

* IMPORTANT INFO FOR ANYONE HAVING PROBLEMS*
using Trevor's Peregrine on MacOSX


I can now say that right now I am running Peregrine on MacOSX 10.8.2
I now figured out why Peregrine failed to see the incoming serial data before.
Any application built around Processing is NOT independent of the Processing serial library.
IF you intend to run Peregrine you must first download Processing and then install the Serial library.
After doing this final step, only then will the serial data be visible to Peregrine.


I now will prove that Trevors hard work is finally working!:beer::beer:


Sorry to bump this up again but is the serial library a separate download? I downloaded Processing but I don't see an option to install the serial library.
 
  • Like
Reactions: ARG

Trevor

Well-known member
Joined
Jul 17, 2009
Messages
4,499
Points
113
Re: Peregrine - The Free LPM Interface

Sorry to bump this up again but is the serial library a separate download? I downloaded Processing but I don't see an option to install the serial library.

No worries! That's what this thread is here for. :D

You're on Mac OS X, I assume? There's a shell command you need to run to get serial running... let me look for where I posted it.

EDIT: This post - http://laserpointerforums.com/f70/peregrine-free-open-source-lpm-interface-80589-5.html#post1173328

Trevor
 
Last edited:

Seoul_lasers

Well-known member
Joined
Jul 4, 2008
Messages
2,680
Points
113
Re: Peregrine - The Free LPM Interface

Sorry to bump this up again but is the serial library a separate download? I downloaded Processing but I don't see an option to install the serial library.

Yes the library was a separate download but according to processing forums is now included.


Trevor is bang on the money here. You'll have to enable the serial library via a shell command.

import processing.serial.*;
Serial serial;
int baudrate = 9600;

void setup() {
serial = new Serial(this, Serial.list()[0], baudrate);
//change the 0 if arduino is not your first com port
}

Trevor, I just used this on my hackintosh, correct me if I am wrong.. this seems to have worked.
 
Last edited:

Trevor

Well-known member
Joined
Jul 17, 2009
Messages
4,499
Points
113
Re: Peregrine - The Free LPM Interface

Yes the library was a separate download but according to processing forums is now included.

Give it a go. If you get an error you'll need to either re-install processing or download the serial library via Ardunio.cc .:thinking:

Hm... downloading the Arduino IDE shouldn't be necessary. At least I would hope not.

If anything, you'd need to just download RXTX - but I'd start with running those shell commands.

EDIT: Oop, S_l edited his post. What's the source code for exactly?

Trevor
 
Last edited:

Seoul_lasers

Well-known member
Joined
Jul 4, 2008
Messages
2,680
Points
113
Re: Peregrine - The Free LPM Interface

Hm... downloading the Arduino IDE shouldn't be necessary. At least I would hope not.

If anything, you'd need to just download RXTX - but I'd start with running those shell commands.

EDIT: Oop, S_l edited his post. What's the source code for exactly?

Trevor


The source code is to get Processing to run the serial library. If not I get an error saying that the library is not installed when it is already.
Kind of strange... I ran this code and it picked up the USB to serial interface off the arduino.
 

LtKernelPanic

Well-known member
Joined
Sep 22, 2010
Messages
1,357
Points
48
Figured out my problem. After posting last night I got thinking I bet I need a driver for the RS323->USB controller in my LB and sure enough as soon as I installed a pl-2303 driver the serial port showed up and everything works great. I'm currently using 10.6.8 on this machine FWIW.
 

Trevor

Well-known member
Joined
Jul 17, 2009
Messages
4,499
Points
113
Figured out my problem. After posting last night I got thinking I bet I need a driver for the RS323->USB controller in my LB and sure enough as soon as I installed a pl-2303 driver the serial port showed up and everything works great. I'm currently using 10.6.8 on this machine FWIW.

Glad it's working! How do you like it?

Trevor
 

Trevor

Well-known member
Joined
Jul 17, 2009
Messages
4,499
Points
113
Trevor, did you get some time to test my changes?

I've actually finally spent a little bit of time playing with it! :D

I'm not sure why my HP laptop didn't like it... maybe I was using the wrong version of Processing or controlp5. Whatever the case, it would end up throwing a NullPointerException and some controls would be missing. It's humming along quite nicely on my Macbook, though! I'll test again on my other laptop when I get the chance.

I like what you've done a lot. The only problem now is change control. Would it be better to fork it and for you to maintain a separate version? It seems like you could keep doing some pretty seriously good stuff - especially if you didn't have to worry about getting your changes into "my" version.

What are your thoughts on the matter?

I'm really happy another developer has gotten their hands in Peregrine! :D

I hope my code wasn't too tough to figure out... seems like all programmers speak a different language. :p

Trevor
 

Atomicrox

Well-known member
Joined
Jun 22, 2011
Messages
2,431
Points
83
Glad you like it!

I added everything I really needed except for one thing - exporting the selection box. I'm pretty sure I won't add enough to justify a fork, and TBH I'm not sure I'll keep developing it at all... my free time keeps shrinking all the time.

OTOH I gree it will be annoying to merge. Have you changed much since the version I used as base?

Your code wasn't that hard, don't worry :)

BTW great work on Peregrine!
 

LtKernelPanic

Well-known member
Joined
Sep 22, 2010
Messages
1,357
Points
48
Glad it's working! How do you like it?

Trevor

Sorry to post and run the other day but I only had a short time to mess with it before having to get things ready for the Fourth weekend.

It works pretty well but I have run into where it stops logging half way through a timed graph on multiple occasions. There's an example of it in my 473 review thread. Other than that it runs pretty darned well.
 




Top