Logging the analog input from Arduino

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Logging the analog input from Arduino

tykockin
Hi All,

I thought what I am trying to do would be simple code to find, but I can’t seem to get it…likely because I know little to nothing about Beanshell coding. Ive an Arduino that is receiving analog  data from a pressure transducer. I can get these data into MM, and see the numbers change in the Device Property Browser window when I click refresh. But how on earth can I log those values somewhere while recording from my Andor Zyla camera?? The objective is to have a text file (or something that can be copied to a text file) that contains the analog-input value from the Arduino at each frame from my recording (10 fps or so max). I am trying to have a reading of pressure that matches with the tiff stack.
Can someone please help me? Or point me to the archive that explains it in some detail? I can find one post where someone wanted to do the same thing, but no real explanation of the code needed to do it.

Any help is appreciated.


Nathan



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Logging the analog input from Arduino

Nico Stuurman-2
Hi Nathan,


On 6/6/2017 6:32 AM, Nathan Tykocki wrote:

> I thought what I am trying to do would be simple code to find, but I
> can’t seem to get it…likely because I know little to nothing about
> Beanshell coding. Ive an Arduino that is receiving analog  data from a
> pressure transducer. I can get these data into MM, and see the numbers
> change in the Device Property Browser window when I click refresh. But
> how on earth can I log those values somewhere while recording from my
> Andor Zyla camera?? The objective is to have a text file (or something
> that can be copied to a text file) that contains the analog-input
> value from the Arduino at each frame from my recording (10 fps or so
> max). I am trying to have a reading of pressure that matches with the
> tiff stack.

In a script, you can read out the analog data using the getProperty
function in the core (
https://valelab4.ucsf.edu/~MM/doc/mmcorej/mmcorej/CMMCore.html#getProperty(java.lang.String,%20java.lang.String 
). It may be easiest to write a script that takes the reading, snaps an
image, puts into a dataset, and inserts the reading into the metadata or
writes it to a file.  The scripting interface changed between 1.4 and
2.0.  For 1.4, look at the testAcq.bsh script, for 2.0, start with the
datastoreExample.bsh script.  If the script does not keep up with the
intended frame rate, you will need to start a burst acquisition and read
out your analog values in a separate thread.

Best,

Nico





------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general
Loading...