time-nuts@lists.febo.com

Discussion of precise time and frequency measurement

View all threads

beaglebones, time, web services

JL
Jim Lux
Sat, Jul 4, 2015 1:13 PM

I've got a project I'm working on to make a sophisticated sundial with
moving mirrors.  I've got a batch of Arduinos that move the mirrors to
the appropriate places, given the current sun angle, etc.

I've got a beaglebone that runs some python code to calculate sun angle
based on time

The beaglebone will have a GPS feeding it to get time.

BUT now, I'd like to add a web interface, so that it can be manipulated
by a mobile device using a browser.

One way I can think of is to run some sort of limited web server. there
are a couple that come with the beaglebone, including the python
"simplehttpserver".

But I'm sort of stuck on the interface between the webserver and the
other code running.

I've done this kind of thing where the one task goes out and updates
files in the tree that's being served by the web server, and that works
fine for "status display" kinds of things that don't update very
quickly. It's also nicely partitioned.

but I want to be able to change the behavior of the system (e.g. by
having the server respond to a PUT or something)

Is the best scheme to go in and modify the webserver code to look for
specific URLs requested, and then fire off some custom code to do what I
want?

I'm not particularly interested in javascript, and would prefer python.

Or are there libraries that make this more cookbook? (the little
"getting started with beaglebone" book talks about flask)

There's quite a few websites out there where someone has done some sort
of "home automation", but they tend to be a bit light on the analysis of
pros and cons of implementation architectures: "I built X using Y and Z
and it sort of works".

Actually, along a similar line.. my "solar position" code isn't very
pretty (it's sort of replicating some code I wrote in Basic a long time
ago, with some changes from stuff I cribbed from ccmatlab).  If someone
knows of a python package that just "does this", I'd love to hear about
it.  Either Az El, or X,Y,Z in ECI or ECF would do.

I've got a project I'm working on to make a sophisticated sundial with moving mirrors. I've got a batch of Arduinos that move the mirrors to the appropriate places, given the current sun angle, etc. I've got a beaglebone that runs some python code to calculate sun angle based on time The beaglebone will have a GPS feeding it to get time. BUT now, I'd like to add a web interface, so that it can be manipulated by a mobile device using a browser. One way I can think of is to run some sort of limited web server. there are a couple that come with the beaglebone, including the python "simplehttpserver". But I'm sort of stuck on the interface between the webserver and the other code running. I've done this kind of thing where the one task goes out and updates files in the tree that's being served by the web server, and that works fine for "status display" kinds of things that don't update very quickly. It's also nicely partitioned. but I want to be able to change the behavior of the system (e.g. by having the server respond to a PUT or something) Is the best scheme to go in and modify the webserver code to look for specific URLs requested, and then fire off some custom code to do what I want? I'm not particularly interested in javascript, and would prefer python. Or are there libraries that make this more cookbook? (the little "getting started with beaglebone" book talks about flask) There's quite a few websites out there where someone has done some sort of "home automation", but they tend to be a bit light on the analysis of pros and cons of implementation architectures: "I built X using Y and Z and it sort of works". Actually, along a similar line.. my "solar position" code isn't very pretty (it's sort of replicating some code I wrote in Basic a long time ago, with some changes from stuff I cribbed from ccmatlab). If someone knows of a python package that just "does this", I'd love to hear about it. Either Az El, or X,Y,Z in ECI or ECF would do.
BD
Bill Dailey
Sat, Jul 4, 2015 6:45 PM

Pysolar

Sent from mobile

On Jul 4, 2015, at 8:13 AM, Jim Lux jimlux@earthlink.net wrote:

I've got a project I'm working on to make a sophisticated sundial with moving mirrors.  I've got a batch of Arduinos that move the mirrors to the appropriate places, given the current sun angle, etc.

I've got a beaglebone that runs some python code to calculate sun angle based on time

The beaglebone will have a GPS feeding it to get time.

BUT now, I'd like to add a web interface, so that it can be manipulated by a mobile device using a browser.

One way I can think of is to run some sort of limited web server. there are a couple that come with the beaglebone, including the python "simplehttpserver".

But I'm sort of stuck on the interface between the webserver and the other code running.

I've done this kind of thing where the one task goes out and updates files in the tree that's being served by the web server, and that works fine for "status display" kinds of things that don't update very quickly. It's also nicely partitioned.

but I want to be able to change the behavior of the system (e.g. by having the server respond to a PUT or something)

Is the best scheme to go in and modify the webserver code to look for specific URLs requested, and then fire off some custom code to do what I want?

I'm not particularly interested in javascript, and would prefer python.

Or are there libraries that make this more cookbook? (the little "getting started with beaglebone" book talks about flask)

There's quite a few websites out there where someone has done some sort of "home automation", but they tend to be a bit light on the analysis of pros and cons of implementation architectures: "I built X using Y and Z and it sort of works".

Actually, along a similar line.. my "solar position" code isn't very pretty (it's sort of replicating some code I wrote in Basic a long time ago, with some changes from stuff I cribbed from ccmatlab).  If someone knows of a python package that just "does this", I'd love to hear about it.  Either Az El, or X,Y,Z in ECI or ECF would do.


time-nuts mailing list -- time-nuts@febo.com
To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
and follow the instructions there.

Pysolar Sent from mobile > On Jul 4, 2015, at 8:13 AM, Jim Lux <jimlux@earthlink.net> wrote: > > I've got a project I'm working on to make a sophisticated sundial with moving mirrors. I've got a batch of Arduinos that move the mirrors to the appropriate places, given the current sun angle, etc. > > I've got a beaglebone that runs some python code to calculate sun angle based on time > > The beaglebone will have a GPS feeding it to get time. > > BUT now, I'd like to add a web interface, so that it can be manipulated by a mobile device using a browser. > > One way I can think of is to run some sort of limited web server. there are a couple that come with the beaglebone, including the python "simplehttpserver". > > But I'm sort of stuck on the interface between the webserver and the other code running. > > I've done this kind of thing where the one task goes out and updates files in the tree that's being served by the web server, and that works fine for "status display" kinds of things that don't update very quickly. It's also nicely partitioned. > > but I want to be able to change the behavior of the system (e.g. by having the server respond to a PUT or something) > > Is the best scheme to go in and modify the webserver code to look for specific URLs requested, and then fire off some custom code to do what I want? > > I'm not particularly interested in javascript, and would prefer python. > > > Or are there libraries that make this more cookbook? (the little "getting started with beaglebone" book talks about flask) > > There's quite a few websites out there where someone has done some sort of "home automation", but they tend to be a bit light on the analysis of pros and cons of implementation architectures: "I built X using Y and Z and it sort of works". > > > Actually, along a similar line.. my "solar position" code isn't very pretty (it's sort of replicating some code I wrote in Basic a long time ago, with some changes from stuff I cribbed from ccmatlab). If someone knows of a python package that just "does this", I'd love to hear about it. Either Az El, or X,Y,Z in ECI or ECF would do. > > > > _______________________________________________ > time-nuts mailing list -- time-nuts@febo.com > To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts > and follow the instructions there.
MM
Mike Magin
Sat, Jul 4, 2015 6:55 PM

Somewhat new time-nut here (had one of the Samsung-branded Z3805s for a
few months as a house 10mhz ref, but it really got out of control when
I acquired a Wavecrest DTS, multiple frequency counters, an old Astron
1250a, a Lucent RFTG-u pair, etc.), thought I should finally de-lurk
since I can perhaps offer some useful opinion on this.  Comments inline.

On Sat, Jul 04, 2015 at 06:13:06AM -0700, Jim Lux wrote:

I've got a project I'm working on to make a sophisticated sundial
with moving mirrors.  I've got a batch of Arduinos that move the
mirrors to the appropriate places, given the current sun angle, etc.

I guess you are making a human-readable sundial, I was thinking recently
about building a computerized mean-solar-noon tracker, just to see what
sort of accuracy I can get.  Haven't decided between a cheap fisheye
camera behind a dark filter (welding lens?) versus a sort of slot-lens
(like a pinhole, but to tolerate the seasonal change in north-south
elevation) with a wide-range light sensor (CdS or a modern ambient light
sensor IC).

I've got a beaglebone that runs some python code to calculate sun
angle based on time

[...]

Or are there libraries that make this more cookbook? (the little
"getting started with beaglebone" book talks about flask)

In a previous contract job, I did some work with Flask, it's pretty
nice, especially for the basic case of "make this subset of the URL
space be handled by this function".

I haven't set it up from scratch, but the Flask documentation seems pretty
good, and if you're already familiar with Python, I'd highly recommend it.

Mike

Somewhat new time-nut here (had one of the Samsung-branded Z3805s for a few months as a house 10mhz ref, but it really got out of control when I acquired a Wavecrest DTS, multiple frequency counters, an old Astron 1250a, a Lucent RFTG-u pair, etc.), thought I should finally de-lurk since I can perhaps offer some useful opinion on this. Comments inline. On Sat, Jul 04, 2015 at 06:13:06AM -0700, Jim Lux wrote: > I've got a project I'm working on to make a sophisticated sundial > with moving mirrors. I've got a batch of Arduinos that move the > mirrors to the appropriate places, given the current sun angle, etc. I guess you are making a human-readable sundial, I was thinking recently about building a computerized mean-solar-noon tracker, just to see what sort of accuracy I can get. Haven't decided between a cheap fisheye camera behind a dark filter (welding lens?) versus a sort of slot-lens (like a pinhole, but to tolerate the seasonal change in north-south elevation) with a wide-range light sensor (CdS or a modern ambient light sensor IC). > I've got a beaglebone that runs some python code to calculate sun > angle based on time [...] > Or are there libraries that make this more cookbook? (the little > "getting started with beaglebone" book talks about flask) In a previous contract job, I did some work with Flask, it's pretty nice, especially for the basic case of "make this subset of the URL space be handled by this function". I haven't set it up from scratch, but the Flask documentation seems pretty good, and if you're already familiar with Python, I'd highly recommend it. Mike
BC
Bob Camp
Sat, Jul 4, 2015 7:31 PM

Hi

As silly as it sounds, having a separate board for the user i/o is probably the best way to go.
You already have an empire of devices that (somehow) chat with each other. The barrier of
“it’s all on one device” has been broken even before i/o has been added.

The world of user input is a bit messy. The typical expectations for speed, help, and fancy looking pages
are pretty high these days. Between input validation, context based help, and feature expansion, the
i/o processor may be fairly busy from time to time.

=====

Once you get past that part of it, it’s all a bunch of “that depends” and personal preference. There is very little
right and wrong. For very little money, you can go from a single core to a quad core device on your i/o
processor. The same is true of RAM and flash. If this is a one up (or few dozen) sort of thing, optimizing the
board probably makes less sense than attacking the (inevitable) multitude of Ardunio gear controlling the
rest of it.

=====

Assuming that we’re not already way off track - I’d use a “real” web server to feed the user. You get the full
range of modules that way. You can handle anything you decide you need as the feature list expands. I’d back
it up with Python, just because it seems to work fine and I already have worked my way up the learning curve. Others
would (I’m sure) recommend languages that they are more familiar with. They all will get you to the same end
result. If you want to be cool, there’s always Node.js …

Bob

On Jul 4, 2015, at 9:13 AM, Jim Lux jimlux@earthlink.net wrote:

I've got a project I'm working on to make a sophisticated sundial with moving mirrors.  I've got a batch of Arduinos that move the mirrors to the appropriate places, given the current sun angle, etc.

I've got a beaglebone that runs some python code to calculate sun angle based on time

The beaglebone will have a GPS feeding it to get time.

BUT now, I'd like to add a web interface, so that it can be manipulated by a mobile device using a browser.

One way I can think of is to run some sort of limited web server. there are a couple that come with the beaglebone, including the python "simplehttpserver".

But I'm sort of stuck on the interface between the webserver and the other code running.

I've done this kind of thing where the one task goes out and updates files in the tree that's being served by the web server, and that works fine for "status display" kinds of things that don't update very quickly. It's also nicely partitioned.

but I want to be able to change the behavior of the system (e.g. by having the server respond to a PUT or something)

Is the best scheme to go in and modify the webserver code to look for specific URLs requested, and then fire off some custom code to do what I want?

I'm not particularly interested in javascript, and would prefer python.

Or are there libraries that make this more cookbook? (the little "getting started with beaglebone" book talks about flask)

There's quite a few websites out there where someone has done some sort of "home automation", but they tend to be a bit light on the analysis of pros and cons of implementation architectures: "I built X using Y and Z and it sort of works".

Actually, along a similar line.. my "solar position" code isn't very pretty (it's sort of replicating some code I wrote in Basic a long time ago, with some changes from stuff I cribbed from ccmatlab).  If someone knows of a python package that just "does this", I'd love to hear about it.  Either Az El, or X,Y,Z in ECI or ECF would do.


time-nuts mailing list -- time-nuts@febo.com
To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
and follow the instructions there.

Hi As silly as it sounds, having a separate board for the user i/o is probably the best way to go. You already have an empire of devices that (somehow) chat with each other. The barrier of “it’s all on one device” has been broken even before i/o has been added. The world of user input is a bit messy. The typical expectations for speed, help, and fancy looking pages are pretty high these days. Between input validation, context based help, and feature expansion, the i/o processor may be fairly busy from time to time. ===== Once you get past that part of it, it’s all a bunch of “that depends” and personal preference. There is very little right and wrong. For very little money, you can go from a single core to a quad core device on your i/o processor. The same is true of RAM and flash. If this is a one up (or few dozen) sort of thing, optimizing the board probably makes less sense than attacking the (inevitable) multitude of Ardunio gear controlling the rest of it. ===== Assuming that we’re not already way off track - I’d use a “real” web server to feed the user. You get the full range of modules that way. You can handle anything you decide you need as the feature list expands. I’d back it up with Python, just because it seems to work fine and I already have worked my way up the learning curve. Others would (I’m sure) recommend languages that they are more familiar with. They all will get you to the same end result. If you want to be cool, there’s always Node.js … Bob > On Jul 4, 2015, at 9:13 AM, Jim Lux <jimlux@earthlink.net> wrote: > > I've got a project I'm working on to make a sophisticated sundial with moving mirrors. I've got a batch of Arduinos that move the mirrors to the appropriate places, given the current sun angle, etc. > > I've got a beaglebone that runs some python code to calculate sun angle based on time > > The beaglebone will have a GPS feeding it to get time. > > BUT now, I'd like to add a web interface, so that it can be manipulated by a mobile device using a browser. > > One way I can think of is to run some sort of limited web server. there are a couple that come with the beaglebone, including the python "simplehttpserver". > > But I'm sort of stuck on the interface between the webserver and the other code running. > > I've done this kind of thing where the one task goes out and updates files in the tree that's being served by the web server, and that works fine for "status display" kinds of things that don't update very quickly. It's also nicely partitioned. > > but I want to be able to change the behavior of the system (e.g. by having the server respond to a PUT or something) > > Is the best scheme to go in and modify the webserver code to look for specific URLs requested, and then fire off some custom code to do what I want? > > I'm not particularly interested in javascript, and would prefer python. > > > Or are there libraries that make this more cookbook? (the little "getting started with beaglebone" book talks about flask) > > There's quite a few websites out there where someone has done some sort of "home automation", but they tend to be a bit light on the analysis of pros and cons of implementation architectures: "I built X using Y and Z and it sort of works". > > > Actually, along a similar line.. my "solar position" code isn't very pretty (it's sort of replicating some code I wrote in Basic a long time ago, with some changes from stuff I cribbed from ccmatlab). If someone knows of a python package that just "does this", I'd love to hear about it. Either Az El, or X,Y,Z in ECI or ECF would do. > > > > _______________________________________________ > time-nuts mailing list -- time-nuts@febo.com > To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts > and follow the instructions there.
SM
Simon Marsh
Sat, Jul 4, 2015 8:42 PM

On 04/07/2015 14:13, Jim Lux wrote:
...

BUT now, I'd like to add a web interface, so that it can be
manipulated by a mobile device using a browser.

...

Is the best scheme to go in and modify the webserver code to look for
specific URLs requested, and then fire off some custom code to do what
I want?

...

No, almost certainly not.

Pretty much every webserver ever written allows you to run a script in
response to a request. Nowadays there are frameworks that integrate
closely with the language of your choice and do all the heavy lifting
for you.

If fact, the problem is really too much choice, here's a list of
frameworks from the Python wiki:
https://wiki.python.org/moin/WebFrameworks

If you want lots of functionality then head for the top of the list, but
these are overkill for what you are trying to do.

Scroll down to the 'Non Full Stack Frameworks' and pick one that makes
sense to you. These should all allow you to route a URL to some Python
code, and the process should be simple enough that if you spend more
than 15 mins to get an example up and running then just ditch it and
move on to the next one.

One caveat, if you are planning to put this on the public internet then
it's a very good idea to proxy the service behind a 'full-fat' webserver
(e.g. apache) that can safely manage access, load, security etc. I
wouldn't expose a BBB directly to the Internet, especially one that is
controlling expensive physical things.

Simon

On 04/07/2015 14:13, Jim Lux wrote: ... > BUT now, I'd like to add a web interface, so that it can be > manipulated by a mobile device using a browser. ... > Is the best scheme to go in and modify the webserver code to look for > specific URLs requested, and then fire off some custom code to do what > I want? ... No, almost certainly not. Pretty much every webserver ever written allows you to run a script in response to a request. Nowadays there are frameworks that integrate closely with the language of your choice and do all the heavy lifting for you. If fact, the problem is really too much choice, here's a list of frameworks from the Python wiki: https://wiki.python.org/moin/WebFrameworks If you want lots of functionality then head for the top of the list, but these are overkill for what you are trying to do. Scroll down to the 'Non Full Stack Frameworks' and pick one that makes sense to you. These should all allow you to route a URL to some Python code, and the process should be simple enough that if you spend more than 15 mins to get an example up and running then just ditch it and move on to the next one. One caveat, if you are planning to put this on the public internet then it's a very good idea to proxy the service behind a 'full-fat' webserver (e.g. apache) that can safely manage access, load, security etc. I wouldn't expose a BBB directly to the Internet, especially one that is controlling expensive physical things. Simon
SB
Steve Berl
Sat, Jul 4, 2015 8:53 PM

pyEphem will get the sun position stuff for you.

-steve

On Sat, Jul 4, 2015 at 6:13 AM, Jim Lux jimlux@earthlink.net wrote:

I've got a project I'm working on to make a sophisticated sundial with
moving mirrors.  I've got a batch of Arduinos that move the mirrors to the
appropriate places, given the current sun angle, etc.

I've got a beaglebone that runs some python code to calculate sun angle
based on time

The beaglebone will have a GPS feeding it to get time.

BUT now, I'd like to add a web interface, so that it can be manipulated by
a mobile device using a browser.

One way I can think of is to run some sort of limited web server. there
are a couple that come with the beaglebone, including the python
"simplehttpserver".

But I'm sort of stuck on the interface between the webserver and the other
code running.

I've done this kind of thing where the one task goes out and updates files
in the tree that's being served by the web server, and that works fine for
"status display" kinds of things that don't update very quickly. It's also
nicely partitioned.

but I want to be able to change the behavior of the system (e.g. by having
the server respond to a PUT or something)

Is the best scheme to go in and modify the webserver code to look for
specific URLs requested, and then fire off some custom code to do what I
want?

I'm not particularly interested in javascript, and would prefer python.

Or are there libraries that make this more cookbook? (the little "getting
started with beaglebone" book talks about flask)

There's quite a few websites out there where someone has done some sort of
"home automation", but they tend to be a bit light on the analysis of pros
and cons of implementation architectures: "I built X using Y and Z and it
sort of works".

Actually, along a similar line.. my "solar position" code isn't very
pretty (it's sort of replicating some code I wrote in Basic a long time
ago, with some changes from stuff I cribbed from ccmatlab).  If someone
knows of a python package that just "does this", I'd love to hear about
it.  Either Az El, or X,Y,Z in ECI or ECF would do.


time-nuts mailing list -- time-nuts@febo.com
To unsubscribe, go to
https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
and follow the instructions there.

--
-steve

pyEphem will get the sun position stuff for you. -steve On Sat, Jul 4, 2015 at 6:13 AM, Jim Lux <jimlux@earthlink.net> wrote: > I've got a project I'm working on to make a sophisticated sundial with > moving mirrors. I've got a batch of Arduinos that move the mirrors to the > appropriate places, given the current sun angle, etc. > > I've got a beaglebone that runs some python code to calculate sun angle > based on time > > The beaglebone will have a GPS feeding it to get time. > > BUT now, I'd like to add a web interface, so that it can be manipulated by > a mobile device using a browser. > > One way I can think of is to run some sort of limited web server. there > are a couple that come with the beaglebone, including the python > "simplehttpserver". > > But I'm sort of stuck on the interface between the webserver and the other > code running. > > I've done this kind of thing where the one task goes out and updates files > in the tree that's being served by the web server, and that works fine for > "status display" kinds of things that don't update very quickly. It's also > nicely partitioned. > > but I want to be able to change the behavior of the system (e.g. by having > the server respond to a PUT or something) > > Is the best scheme to go in and modify the webserver code to look for > specific URLs requested, and then fire off some custom code to do what I > want? > > I'm not particularly interested in javascript, and would prefer python. > > > Or are there libraries that make this more cookbook? (the little "getting > started with beaglebone" book talks about flask) > > There's quite a few websites out there where someone has done some sort of > "home automation", but they tend to be a bit light on the analysis of pros > and cons of implementation architectures: "I built X using Y and Z and it > sort of works". > > > Actually, along a similar line.. my "solar position" code isn't very > pretty (it's sort of replicating some code I wrote in Basic a long time > ago, with some changes from stuff I cribbed from ccmatlab). If someone > knows of a python package that just "does this", I'd love to hear about > it. Either Az El, or X,Y,Z in ECI or ECF would do. > > > > _______________________________________________ > time-nuts mailing list -- time-nuts@febo.com > To unsubscribe, go to > https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts > and follow the instructions there. > -- -steve
JL
Jim Lux
Sat, Jul 4, 2015 11:14 PM

On 7/4/15 11:45 AM, Bill Dailey wrote:

Pysolar

Sent from mobile

"Pysolar: staring directly at the sun since 2007"

excellent.. thanks..

On 7/4/15 11:45 AM, Bill Dailey wrote: > Pysolar > > Sent from mobile > "Pysolar: staring directly at the sun since 2007" excellent.. thanks..
JL
Jim Lux
Sun, Jul 5, 2015 12:06 AM

On 7/4/15 11:55 AM, Mike Magin wrote:

Somewhat new time-nut here (had one of the Samsung-branded Z3805s for a
few months as a house 10mhz ref, but it really got out of control when
I acquired a Wavecrest DTS, multiple frequency counters, an old Astron
1250a, a Lucent RFTG-u pair, etc.), thought I should finally de-lurk
since I can perhaps offer some useful opinion on this.  Comments inline.

On Sat, Jul 04, 2015 at 06:13:06AM -0700, Jim Lux wrote:

I've got a project I'm working on to make a sophisticated sundial
with moving mirrors.  I've got a batch of Arduinos that move the
mirrors to the appropriate places, given the current sun angle, etc.

I guess you are making a human-readable sundial,

Exactly... I've got an array of mirrors on az/el mounts (two servos
stacked) and the reflection from the mirrors on the wall forms the display.

I was thinking recently

about building a computerized mean-solar-noon tracker, just to see what
sort of accuracy I can get.  Haven't decided between a cheap fisheye
camera behind a dark filter (welding lens?) versus a sort of slot-lens
(like a pinhole, but to tolerate the seasonal change in north-south
elevation) with a wide-range light sensor (CdS or a modern ambient light
sensor IC).

How accurate do you need to be..

two/four solar cells with a hole that projects an image of the sun on
the cells, and compare the outputs (classic sun sensor for a satellite)

spinning mirror and fixed solar cell, timing of pulse tells you where
the sun is

camera with a wide angle lens, and then do multi-pixel centroiding (0.1
pixel is easy)

camera sensor with a plate with tiny holes in it, with the spacing of
the holes slightly different than the pixels, so the "sun spots" have
slightly different coverages of each pixel.

I've got a beaglebone that runs some python code to calculate sun
angle based on time

[...]

Or are there libraries that make this more cookbook? (the little
"getting started with beaglebone" book talks about flask)

In a previous contract job, I did some work with Flask, it's pretty
nice, especially for the basic case of "make this subset of the URL
space be handled by this function".

I haven't set it up from scratch, but the Flask documentation seems pretty
good, and if you're already familiar with Python, I'd highly recommend it.

Well, I got it to do the beginner "click here and turn on/off the LED"
thing..

What I'd like, though, is to separate the "web serving" thread and the
"doing stuff thread". I suppose I can fire off a thread from the
webserver python.

On 7/4/15 11:55 AM, Mike Magin wrote: > Somewhat new time-nut here (had one of the Samsung-branded Z3805s for a > few months as a house 10mhz ref, but it really got out of control when > I acquired a Wavecrest DTS, multiple frequency counters, an old Astron > 1250a, a Lucent RFTG-u pair, etc.), thought I should finally de-lurk > since I can perhaps offer some useful opinion on this. Comments inline. > > On Sat, Jul 04, 2015 at 06:13:06AM -0700, Jim Lux wrote: >> I've got a project I'm working on to make a sophisticated sundial >> with moving mirrors. I've got a batch of Arduinos that move the >> mirrors to the appropriate places, given the current sun angle, etc. > > I guess you are making a human-readable sundial, Exactly... I've got an array of mirrors on az/el mounts (two servos stacked) and the reflection from the mirrors on the wall forms the display. I was thinking recently > about building a computerized mean-solar-noon tracker, just to see what > sort of accuracy I can get. Haven't decided between a cheap fisheye > camera behind a dark filter (welding lens?) versus a sort of slot-lens > (like a pinhole, but to tolerate the seasonal change in north-south > elevation) with a wide-range light sensor (CdS or a modern ambient light > sensor IC). How accurate do you need to be.. two/four solar cells with a hole that projects an image of the sun on the cells, and compare the outputs (classic sun sensor for a satellite) spinning mirror and fixed solar cell, timing of pulse tells you where the sun is camera with a wide angle lens, and then do multi-pixel centroiding (0.1 pixel is easy) camera sensor with a plate with tiny holes in it, with the spacing of the holes slightly different than the pixels, so the "sun spots" have slightly different coverages of each pixel. > >> I've got a beaglebone that runs some python code to calculate sun >> angle based on time > [...] >> Or are there libraries that make this more cookbook? (the little >> "getting started with beaglebone" book talks about flask) > > In a previous contract job, I did some work with Flask, it's pretty > nice, especially for the basic case of "make this subset of the URL > space be handled by this function". > > I haven't set it up from scratch, but the Flask documentation seems pretty > good, and if you're already familiar with Python, I'd highly recommend it. Well, I got it to do the beginner "click here and turn on/off the LED" thing.. What I'd like, though, is to separate the "web serving" thread and the "doing stuff thread". I suppose I can fire off a thread from the webserver python.
JL
Jim Lux
Sun, Jul 5, 2015 12:11 AM

On 7/4/15 12:31 PM, Bob Camp wrote:

Hi

As silly as it sounds, having a separate board for the user i/o is probably the best way to go.
You already have an empire of devices that (somehow) chat with each other. The barrier of
“it’s all on one device” has been broken even before i/o has been added.

Well, sure.. that's what the BBB is for.. mostly the UI.  but at some
point, the web server has to tell someone else what to do.  You can fire
off another process, send a message to another processor (or thread), or
whatever.

And I was looking for a simple(!) webserver that supports this level of
sophistication.  There's plenty of very lightweight examples out there
(that run on Arduinos for instance) that are basically single threaded..
you intercept the "GET /myfunction" (or whatever) and that turns into a
"call abc(parameters)"... and while "abc()" is running, the webserver
isn't.  That's fine for "setting parameters", but not good if the abc
process is going to take minutes.

Once you get past that part of it, it’s all a bunch of “that depends” and personal preference. There is very little
right and wrong. For very little money, you can go from a single core to a quad core device on your i/o
processor. The same is true of RAM and flash. If this is a one up (or few dozen) sort of thing, optimizing the
board probably makes less sense than attacking the (inevitable) multitude of Ardunio gear controlling the
rest of it.

=====

Assuming that we’re not already way off track - I’d use a “real” web server to feed the user. You get the full
range of modules that way. You can handle anything you decide you need as the feature list expands. I’d back
it up with Python, just because it seems to work fine and I already have worked my way up the learning curve. Others
would (I’m sure) recommend languages that they are more familiar with. They all will get you to the same end
result. If you want to be cool, there’s always Node.js …

Yeah, that's where I'm heading.. but I was looking for something between
"single threaded webserver with direct calls" and "install apache"

On 7/4/15 12:31 PM, Bob Camp wrote: > Hi > > As silly as it sounds, having a separate board for the user i/o is probably the best way to go. > You already have an empire of devices that (somehow) chat with each other. The barrier of > “it’s all on one device” has been broken even before i/o has been added. Well, sure.. that's what the BBB is for.. mostly the UI. but at some point, the web server has to tell someone else what to do. You can fire off another process, send a message to another processor (or thread), or whatever. And I was looking for a simple(!) webserver that supports this level of sophistication. There's plenty of very lightweight examples out there (that run on Arduinos for instance) that are basically single threaded.. you intercept the "GET /myfunction" (or whatever) and that turns into a "call abc(parameters)"... and while "abc()" is running, the webserver isn't. That's fine for "setting parameters", but not good if the abc process is going to take minutes. > Once you get past that part of it, it’s all a bunch of “that depends” and personal preference. There is very little > right and wrong. For very little money, you can go from a single core to a quad core device on your i/o > processor. The same is true of RAM and flash. If this is a one up (or few dozen) sort of thing, optimizing the > board probably makes less sense than attacking the (inevitable) multitude of Ardunio gear controlling the > rest of it. > > ===== > > Assuming that we’re not already way off track - I’d use a “real” web server to feed the user. You get the full > range of modules that way. You can handle anything you decide you need as the feature list expands. I’d back > it up with Python, just because it seems to work fine and I already have worked my way up the learning curve. Others > would (I’m sure) recommend languages that they are more familiar with. They all will get you to the same end > result. If you want to be cool, there’s always Node.js … Yeah, that's where I'm heading.. but I was looking for something between "single threaded webserver with direct calls" and "install apache"
JL
Jim Lux
Sun, Jul 5, 2015 12:14 AM

On 7/4/15 1:42 PM, Simon Marsh wrote:

Pretty much every webserver ever written allows you to run a script in
response to a request. Nowadays there are frameworks that integrate
closely with the language of your choice and do all the heavy lifting
for you.

If fact, the problem is really too much choice, here's a list of
frameworks from the Python wiki:
https://wiki.python.org/moin/WebFrameworks

Yep.. that's exactly the problem... So I was consulting the hivemind
here... we tend to be building little widgets that are more than a
blinky light, but also aren't serving airline reservation systems.

If you want lots of functionality then head for the top of the list, but
these are overkill for what you are trying to do.

Scroll down to the 'Non Full Stack Frameworks' and pick one that makes
sense to you. These should all allow you to route a URL to some Python
code, and the process should be simple enough that if you spend more
than 15 mins to get an example up and running then just ditch it and
move on to the next one.

That's where I am...

flask does reasonably good..
I haven't tried firing off a second thread yet..

One caveat, if you are planning to put this on the public internet then
it's a very good idea to proxy the service behind a 'full-fat' webserver
(e.g. apache) that can safely manage access, load, security etc. I
wouldn't expose a BBB directly to the Internet, especially one that is
controlling expensive physical things.

Nope.. just local access from my phone on my network

And the hardware isn't breakable(!)  at least not by anything that any
of the processors can do.

On 7/4/15 1:42 PM, Simon Marsh wrote: > > > > Pretty much every webserver ever written allows you to run a script in > response to a request. Nowadays there are frameworks that integrate > closely with the language of your choice and do all the heavy lifting > for you. > > If fact, the problem is really too much choice, here's a list of > frameworks from the Python wiki: > https://wiki.python.org/moin/WebFrameworks Yep.. that's exactly the problem... So I was consulting the hivemind here... we tend to be building little widgets that are more than a blinky light, but also aren't serving airline reservation systems. > > If you want lots of functionality then head for the top of the list, but > these are overkill for what you are trying to do. > > Scroll down to the 'Non Full Stack Frameworks' and pick one that makes > sense to you. These should all allow you to route a URL to some Python > code, and the process should be simple enough that if you spend more > than 15 mins to get an example up and running then just ditch it and > move on to the next one. That's where I am... flask does reasonably good.. I haven't tried firing off a second thread yet.. > > One caveat, if you are planning to put this on the public internet then > it's a very good idea to proxy the service behind a 'full-fat' webserver > (e.g. apache) that can safely manage access, load, security etc. I > wouldn't expose a BBB directly to the Internet, especially one that is > controlling expensive physical things. Nope.. just local access from *my* phone on *my* network And the hardware isn't breakable(!) at least not by anything that any of the processors can do.
DJ
Didier Juges
Sun, Jul 5, 2015 7:13 PM

I have been working on and off on that kind of project for a while.
One type of issue you have when trying to control hardware from a web page is that any hardware access from a web server poses many issues, such as permissions and the fact that web servers are basically stateless and many are multitasking.
What happens if your web page (or the python script behind it) tries to send data on a serial port (for instance) and another request for the same thing comes along?

The current approach I am using is to have a separate process that maintains the device status in files that be easily accessed by the web server, so that simple status requests can be serviced immediately without needing to query the device each time, and use a fifo to pipe commands between the web page script and the process. The process is the only one that talks to the hardware, so there is no contention.

On the client side, you can use Ajax to keep the web page updated with fresh data without reloading everything each time. It is JavaScript, but there is not too much of it. That part is relatively easy, unless you want to make it really pretty. In that case, it takes a different set of skills (art major with CSS experience...)

Here is a demo:

http://www.ko4bb.com/AjaxDemo/x-web.html

The back end of that runs on php, but it could be python just the same.

Obviously failing the "pretty" test :)

Didier KO4BB

On July 4, 2015 8:13:06 AM CDT, Jim Lux jimlux@earthlink.net wrote:

I've got a project I'm working on to make a sophisticated sundial with
moving mirrors.  I've got a batch of Arduinos that move the mirrors to
the appropriate places, given the current sun angle, etc.

I've got a beaglebone that runs some python code to calculate sun angle

based on time

The beaglebone will have a GPS feeding it to get time.

BUT now, I'd like to add a web interface, so that it can be manipulated

by a mobile device using a browser.

One way I can think of is to run some sort of limited web server. there

are a couple that come with the beaglebone, including the python
"simplehttpserver".

But I'm sort of stuck on the interface between the webserver and the
other code running.

I've done this kind of thing where the one task goes out and updates
files in the tree that's being served by the web server, and that works

fine for "status display" kinds of things that don't update very
quickly. It's also nicely partitioned.

but I want to be able to change the behavior of the system (e.g. by
having the server respond to a PUT or something)

Is the best scheme to go in and modify the webserver code to look for
specific URLs requested, and then fire off some custom code to do what
I
want?

I'm not particularly interested in javascript, and would prefer python.

Or are there libraries that make this more cookbook? (the little
"getting started with beaglebone" book talks about flask)

There's quite a few websites out there where someone has done some sort

of "home automation", but they tend to be a bit light on the analysis
of
pros and cons of implementation architectures: "I built X using Y and Z

and it sort of works".

Actually, along a similar line.. my "solar position" code isn't very
pretty (it's sort of replicating some code I wrote in Basic a long time

ago, with some changes from stuff I cribbed from ccmatlab).  If someone

knows of a python package that just "does this", I'd love to hear about

it.  Either Az El, or X,Y,Z in ECI or ECF would do.


time-nuts mailing list -- time-nuts@febo.com
To unsubscribe, go to
https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
and follow the instructions there.

--
Sent from my Motorola Droid Razr HD 4G LTE wireless tracker while I do other things.

I have been working on and off on that kind of project for a while. One type of issue you have when trying to control hardware from a web page is that any hardware access from a web server poses many issues, such as permissions and the fact that web servers are basically stateless and many are multitasking. What happens if your web page (or the python script behind it) tries to send data on a serial port (for instance) and another request for the same thing comes along? The current approach I am using is to have a separate process that maintains the device status in files that be easily accessed by the web server, so that simple status requests can be serviced immediately without needing to query the device each time, and use a fifo to pipe commands between the web page script and the process. The process is the only one that talks to the hardware, so there is no contention. On the client side, you can use Ajax to keep the web page updated with fresh data without reloading everything each time. It is JavaScript, but there is not too much of it. That part is relatively easy, unless you want to make it really pretty. In that case, it takes a different set of skills (art major with CSS experience...) Here is a demo: http://www.ko4bb.com/AjaxDemo/x-web.html The back end of that runs on php, but it could be python just the same. Obviously failing the "pretty" test :) Didier KO4BB On July 4, 2015 8:13:06 AM CDT, Jim Lux <jimlux@earthlink.net> wrote: >I've got a project I'm working on to make a sophisticated sundial with >moving mirrors. I've got a batch of Arduinos that move the mirrors to >the appropriate places, given the current sun angle, etc. > >I've got a beaglebone that runs some python code to calculate sun angle > >based on time > >The beaglebone will have a GPS feeding it to get time. > >BUT now, I'd like to add a web interface, so that it can be manipulated > >by a mobile device using a browser. > >One way I can think of is to run some sort of limited web server. there > >are a couple that come with the beaglebone, including the python >"simplehttpserver". > >But I'm sort of stuck on the interface between the webserver and the >other code running. > >I've done this kind of thing where the one task goes out and updates >files in the tree that's being served by the web server, and that works > >fine for "status display" kinds of things that don't update very >quickly. It's also nicely partitioned. > >but I want to be able to change the behavior of the system (e.g. by >having the server respond to a PUT or something) > >Is the best scheme to go in and modify the webserver code to look for >specific URLs requested, and then fire off some custom code to do what >I >want? > >I'm not particularly interested in javascript, and would prefer python. > > >Or are there libraries that make this more cookbook? (the little >"getting started with beaglebone" book talks about flask) > >There's quite a few websites out there where someone has done some sort > >of "home automation", but they tend to be a bit light on the analysis >of >pros and cons of implementation architectures: "I built X using Y and Z > >and it sort of works". > > >Actually, along a similar line.. my "solar position" code isn't very >pretty (it's sort of replicating some code I wrote in Basic a long time > >ago, with some changes from stuff I cribbed from ccmatlab). If someone > >knows of a python package that just "does this", I'd love to hear about > >it. Either Az El, or X,Y,Z in ECI or ECF would do. > > > >_______________________________________________ >time-nuts mailing list -- time-nuts@febo.com >To unsubscribe, go to >https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts >and follow the instructions there. -- Sent from my Motorola Droid Razr HD 4G LTE wireless tracker while I do other things.
CA
Chris Albertson
Mon, Jul 6, 2015 2:47 AM

Keep it simple, use a Cgi bin script.  Your url is can be any executable.
Any language you like. The script can do anything and then it writes out
html to stdout. Simple enough.  .

On Saturday, July 4, 2015, Jim Lux jimlux@earthlink.net wrote:

I've got a project I'm working on to make a sophisticated sundial with
moving mirrors.  I've got a batch of Arduinos that move the mirrors to the
appropriate places, given the current sun angle, etc.

I've got a beaglebone that runs some python code to calculate sun angle
based on time

The beaglebone will have a GPS feeding it to get time.

BUT now, I'd like to add a web interface, so that it can be manipulated by
a mobile device using a browser.

One way I can think of is to run some sort of limited web server. there
are a couple that come with the beaglebone, including the python
"simplehttpserver".

But I'm sort of stuck on the interface between the webserver and the other
code running.

I've done this kind of thing where the one task goes out and updates files
in the tree that's being served by the web server, and that works fine for
"status display" kinds of things that don't update very quickly. It's also
nicely partitioned.

but I want to be able to change the behavior of the system (e.g. by having
the server respond to a PUT or something)

Is the best scheme to go in and modify the webserver code to look for
specific URLs requested, and then fire off some custom code to do what I
want?

I'm not particularly interested in javascript, and would prefer python.

Or are there libraries that make this more cookbook? (the little "getting
started with beaglebone" book talks about flask)

There's quite a few websites out there where someone has done some sort of
"home automation", but they tend to be a bit light on the analysis of pros
and cons of implementation architectures: "I built X using Y and Z and it
sort of works".

Actually, along a similar line.. my "solar position" code isn't very
pretty (it's sort of replicating some code I wrote in Basic a long time
ago, with some changes from stuff I cribbed from ccmatlab).  If someone
knows of a python package that just "does this", I'd love to hear about
it.  Either Az El, or X,Y,Z in ECI or ECF would do.


time-nuts mailing list -- time-nuts@febo.com
To unsubscribe, go to
https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
and follow the instructions there.

--

Chris Albertson
Redondo Beach, California

Keep it simple, use a Cgi bin script. Your url is can be any executable. Any language you like. The script can do anything and then it writes out html to stdout. Simple enough. . On Saturday, July 4, 2015, Jim Lux <jimlux@earthlink.net> wrote: > I've got a project I'm working on to make a sophisticated sundial with > moving mirrors. I've got a batch of Arduinos that move the mirrors to the > appropriate places, given the current sun angle, etc. > > I've got a beaglebone that runs some python code to calculate sun angle > based on time > > The beaglebone will have a GPS feeding it to get time. > > BUT now, I'd like to add a web interface, so that it can be manipulated by > a mobile device using a browser. > > One way I can think of is to run some sort of limited web server. there > are a couple that come with the beaglebone, including the python > "simplehttpserver". > > But I'm sort of stuck on the interface between the webserver and the other > code running. > > I've done this kind of thing where the one task goes out and updates files > in the tree that's being served by the web server, and that works fine for > "status display" kinds of things that don't update very quickly. It's also > nicely partitioned. > > but I want to be able to change the behavior of the system (e.g. by having > the server respond to a PUT or something) > > Is the best scheme to go in and modify the webserver code to look for > specific URLs requested, and then fire off some custom code to do what I > want? > > I'm not particularly interested in javascript, and would prefer python. > > > Or are there libraries that make this more cookbook? (the little "getting > started with beaglebone" book talks about flask) > > There's quite a few websites out there where someone has done some sort of > "home automation", but they tend to be a bit light on the analysis of pros > and cons of implementation architectures: "I built X using Y and Z and it > sort of works". > > > Actually, along a similar line.. my "solar position" code isn't very > pretty (it's sort of replicating some code I wrote in Basic a long time > ago, with some changes from stuff I cribbed from ccmatlab). If someone > knows of a python package that just "does this", I'd love to hear about > it. Either Az El, or X,Y,Z in ECI or ECF would do. > > > > _______________________________________________ > time-nuts mailing list -- time-nuts@febo.com > To unsubscribe, go to > https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts > and follow the instructions there. > -- Chris Albertson Redondo Beach, California
TH
Tom Harris
Mon, Jul 6, 2015 10:19 PM

Since you want simple just use a CGI script written in your language of
choice. Very easy technology to learn, Python has support libraries out of
the box if you want. You have a webpge with carious simple controls on it
like buttons etc, you click a special button that posts a request to a URL,
the webserver runs a script that generates the response, the webserver
serves it out, your browser displays it. Why bother with learning a
framework? Messing about with mechanics is far more fun!

Tom Harris celephicus@gmail.com

On 4 July 2015 at 23:13, Jim Lux jimlux@earthlink.net wrote:

I've got a project I'm working on to make a sophisticated sundial with
moving mirrors.  I've got a batch of Arduinos that move the mirrors to the
appropriate places, given the current sun angle, etc.

I've got a beaglebone that runs some python code to calculate sun angle
based on time

The beaglebone will have a GPS feeding it to get time.

BUT now, I'd like to add a web interface, so that it can be manipulated by
a mobile device using a browser.

One way I can think of is to run some sort of limited web server. there
are a couple that come with the beaglebone, including the python
"simplehttpserver".

But I'm sort of stuck on the interface between the webserver and the other
code running.

I've done this kind of thing where the one task goes out and updates files
in the tree that's being served by the web server, and that works fine for
"status display" kinds of things that don't update very quickly. It's also
nicely partitioned.

but I want to be able to change the behavior of the system (e.g. by having
the server respond to a PUT or something)

Is the best scheme to go in and modify the webserver code to look for
specific URLs requested, and then fire off some custom code to do what I
want?

I'm not particularly interested in javascript, and would prefer python.

Or are there libraries that make this more cookbook? (the little "getting
started with beaglebone" book talks about flask)

There's quite a few websites out there where someone has done some sort of
"home automation", but they tend to be a bit light on the analysis of pros
and cons of implementation architectures: "I built X using Y and Z and it
sort of works".

Actually, along a similar line.. my "solar position" code isn't very
pretty (it's sort of replicating some code I wrote in Basic a long time
ago, with some changes from stuff I cribbed from ccmatlab).  If someone
knows of a python package that just "does this", I'd love to hear about
it.  Either Az El, or X,Y,Z in ECI or ECF would do.


time-nuts mailing list -- time-nuts@febo.com
To unsubscribe, go to
https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
and follow the instructions there.

Since you want simple just use a CGI script written in your language of choice. Very easy technology to learn, Python has support libraries out of the box if you want. You have a webpge with carious simple controls on it like buttons etc, you click a special button that posts a request to a URL, the webserver runs a script that generates the response, the webserver serves it out, your browser displays it. Why bother with learning a framework? Messing about with mechanics is far more fun! Tom Harris <celephicus@gmail.com> On 4 July 2015 at 23:13, Jim Lux <jimlux@earthlink.net> wrote: > I've got a project I'm working on to make a sophisticated sundial with > moving mirrors. I've got a batch of Arduinos that move the mirrors to the > appropriate places, given the current sun angle, etc. > > I've got a beaglebone that runs some python code to calculate sun angle > based on time > > The beaglebone will have a GPS feeding it to get time. > > BUT now, I'd like to add a web interface, so that it can be manipulated by > a mobile device using a browser. > > One way I can think of is to run some sort of limited web server. there > are a couple that come with the beaglebone, including the python > "simplehttpserver". > > But I'm sort of stuck on the interface between the webserver and the other > code running. > > I've done this kind of thing where the one task goes out and updates files > in the tree that's being served by the web server, and that works fine for > "status display" kinds of things that don't update very quickly. It's also > nicely partitioned. > > but I want to be able to change the behavior of the system (e.g. by having > the server respond to a PUT or something) > > Is the best scheme to go in and modify the webserver code to look for > specific URLs requested, and then fire off some custom code to do what I > want? > > I'm not particularly interested in javascript, and would prefer python. > > > Or are there libraries that make this more cookbook? (the little "getting > started with beaglebone" book talks about flask) > > There's quite a few websites out there where someone has done some sort of > "home automation", but they tend to be a bit light on the analysis of pros > and cons of implementation architectures: "I built X using Y and Z and it > sort of works". > > > Actually, along a similar line.. my "solar position" code isn't very > pretty (it's sort of replicating some code I wrote in Basic a long time > ago, with some changes from stuff I cribbed from ccmatlab). If someone > knows of a python package that just "does this", I'd love to hear about > it. Either Az El, or X,Y,Z in ECI or ECF would do. > > > > _______________________________________________ > time-nuts mailing list -- time-nuts@febo.com > To unsubscribe, go to > https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts > and follow the instructions there. >
JL
Jim Lux
Tue, Jul 7, 2015 2:24 AM

On 7/6/15 3:19 PM, Tom Harris wrote:

Since you want simple just use a CGI script written in your language of
choice. Very easy technology to learn, Python has support libraries out of
the box if you want. You have a webpge with carious simple controls on it
like buttons etc, you click a special button that posts a request to a URL,
the webserver runs a script that generates the response, the webserver
serves it out, your browser displays it. Why bother with learning a
framework? Messing about with mechanics is far more fun!

The only hiccup with the cgi approach (and with "directly code the
action in the guts of the server" like with flask) is that the
subprocess that's spawned has to complete before control returns (e.g.
to serve stdout to the user). So if you want to fire off a task that
will run in parallel with the webserver's other stuff, you need to have
some sort of interprocess communication (e.g. a named pipe, socket,
file, MPI communicator, etc.).  (or you do something like run "at" or
"batch", which is basically using a file as a interprocess
communication, and the at daemon watches the file)

On 7/6/15 3:19 PM, Tom Harris wrote: > Since you want simple just use a CGI script written in your language of > choice. Very easy technology to learn, Python has support libraries out of > the box if you want. You have a webpge with carious simple controls on it > like buttons etc, you click a special button that posts a request to a URL, > the webserver runs a script that generates the response, the webserver > serves it out, your browser displays it. Why bother with learning a > framework? Messing about with mechanics is far more fun! > > The only hiccup with the cgi approach (and with "directly code the action in the guts of the server" like with flask) is that the subprocess that's spawned has to complete before control returns (e.g. to serve stdout to the user). So if you want to fire off a task that will run in parallel with the webserver's other stuff, you need to have some sort of interprocess communication (e.g. a named pipe, socket, file, MPI communicator, etc.). (or you do something like run "at" or "batch", which is basically using a file as a interprocess communication, and the at daemon watches the file)
CA
Chris Albertson
Tue, Jul 7, 2015 2:28 AM

Yes cgi scripts take a few hours to learn and take only a small processor.
Drubbing a dims and all is overkill and will not perform well on the BBB.

On Monday, July 6, 2015, Tom Harris celephicus@gmail.com wrote:

Since you want simple just use a CGI script written in your language of
choice. Very easy technology to learn, Python has support libraries out of
the box if you want. You have a webpge with carious simple controls on it
like buttons etc, you click a special button that posts a request to a URL,
the webserver runs a script that generates the response, the webserver
serves it out, your browser displays it. Why bother with learning a
framework? Messing about with mechanics is far more fun!

Tom Harris <celephicus@gmail.com javascript:;>

On 4 July 2015 at 23:13, Jim Lux <jimlux@earthlink.net javascript:;>
wrote:

I've got a project I'm working on to make a sophisticated sundial with
moving mirrors.  I've got a batch of Arduinos that move the mirrors to

the

appropriate places, given the current sun angle, etc.

I've got a beaglebone that runs some python code to calculate sun angle
based on time

The beaglebone will have a GPS feeding it to get time.

BUT now, I'd like to add a web interface, so that it can be manipulated

by

a mobile device using a browser.

One way I can think of is to run some sort of limited web server. there
are a couple that come with the beaglebone, including the python
"simplehttpserver".

But I'm sort of stuck on the interface between the webserver and the

other

code running.

I've done this kind of thing where the one task goes out and updates

files

in the tree that's being served by the web server, and that works fine

for

"status display" kinds of things that don't update very quickly. It's

also

nicely partitioned.

but I want to be able to change the behavior of the system (e.g. by

having

the server respond to a PUT or something)

Is the best scheme to go in and modify the webserver code to look for
specific URLs requested, and then fire off some custom code to do what I
want?

I'm not particularly interested in javascript, and would prefer python.

Or are there libraries that make this more cookbook? (the little "getting
started with beaglebone" book talks about flask)

There's quite a few websites out there where someone has done some sort

of

"home automation", but they tend to be a bit light on the analysis of

pros

and cons of implementation architectures: "I built X using Y and Z and it
sort of works".

Actually, along a similar line.. my "solar position" code isn't very
pretty (it's sort of replicating some code I wrote in Basic a long time
ago, with some changes from stuff I cribbed from ccmatlab).  If someone
knows of a python package that just "does this", I'd love to hear about
it.  Either Az El, or X,Y,Z in ECI or ECF would do.


time-nuts mailing list -- time-nuts@febo.com javascript:;
To unsubscribe, go to
https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
and follow the instructions there.


time-nuts mailing list -- time-nuts@febo.com javascript:;
To unsubscribe, go to
https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
and follow the instructions there.

--

Chris Albertson
Redondo Beach, California

Yes cgi scripts take a few hours to learn and take only a small processor. Drubbing a dims and all is overkill and will not perform well on the BBB. On Monday, July 6, 2015, Tom Harris <celephicus@gmail.com> wrote: > Since you want simple just use a CGI script written in your language of > choice. Very easy technology to learn, Python has support libraries out of > the box if you want. You have a webpge with carious simple controls on it > like buttons etc, you click a special button that posts a request to a URL, > the webserver runs a script that generates the response, the webserver > serves it out, your browser displays it. Why bother with learning a > framework? Messing about with mechanics is far more fun! > > > Tom Harris <celephicus@gmail.com <javascript:;>> > > On 4 July 2015 at 23:13, Jim Lux <jimlux@earthlink.net <javascript:;>> > wrote: > > > I've got a project I'm working on to make a sophisticated sundial with > > moving mirrors. I've got a batch of Arduinos that move the mirrors to > the > > appropriate places, given the current sun angle, etc. > > > > I've got a beaglebone that runs some python code to calculate sun angle > > based on time > > > > The beaglebone will have a GPS feeding it to get time. > > > > BUT now, I'd like to add a web interface, so that it can be manipulated > by > > a mobile device using a browser. > > > > One way I can think of is to run some sort of limited web server. there > > are a couple that come with the beaglebone, including the python > > "simplehttpserver". > > > > But I'm sort of stuck on the interface between the webserver and the > other > > code running. > > > > I've done this kind of thing where the one task goes out and updates > files > > in the tree that's being served by the web server, and that works fine > for > > "status display" kinds of things that don't update very quickly. It's > also > > nicely partitioned. > > > > but I want to be able to change the behavior of the system (e.g. by > having > > the server respond to a PUT or something) > > > > Is the best scheme to go in and modify the webserver code to look for > > specific URLs requested, and then fire off some custom code to do what I > > want? > > > > I'm not particularly interested in javascript, and would prefer python. > > > > > > Or are there libraries that make this more cookbook? (the little "getting > > started with beaglebone" book talks about flask) > > > > There's quite a few websites out there where someone has done some sort > of > > "home automation", but they tend to be a bit light on the analysis of > pros > > and cons of implementation architectures: "I built X using Y and Z and it > > sort of works". > > > > > > Actually, along a similar line.. my "solar position" code isn't very > > pretty (it's sort of replicating some code I wrote in Basic a long time > > ago, with some changes from stuff I cribbed from ccmatlab). If someone > > knows of a python package that just "does this", I'd love to hear about > > it. Either Az El, or X,Y,Z in ECI or ECF would do. > > > > > > > > _______________________________________________ > > time-nuts mailing list -- time-nuts@febo.com <javascript:;> > > To unsubscribe, go to > > https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts > > and follow the instructions there. > > > _______________________________________________ > time-nuts mailing list -- time-nuts@febo.com <javascript:;> > To unsubscribe, go to > https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts > and follow the instructions there. > -- Chris Albertson Redondo Beach, California
BC
Bob Camp
Tue, Jul 7, 2015 11:13 AM

Hi

Having done this on very small machines with cgi before, the lag has never been
an issue. Yes, the things I do are “tweaks” to variables, or data requests. I do not try
to spawn a piece of code to compute PI to 800 places and wait for the result.

Bob

On Jul 6, 2015, at 10:24 PM, Jim Lux jimlux@earthlink.net wrote:

On 7/6/15 3:19 PM, Tom Harris wrote:

Since you want simple just use a CGI script written in your language of
choice. Very easy technology to learn, Python has support libraries out of
the box if you want. You have a webpge with carious simple controls on it
like buttons etc, you click a special button that posts a request to a URL,
the webserver runs a script that generates the response, the webserver
serves it out, your browser displays it. Why bother with learning a
framework? Messing about with mechanics is far more fun!

The only hiccup with the cgi approach (and with "directly code the action in the guts of the server" like with flask) is that the subprocess that's spawned has to complete before control returns (e.g. to serve stdout to the user). So if you want to fire off a task that will run in parallel with the webserver's other stuff, you need to have some sort of interprocess communication (e.g. a named pipe, socket, file, MPI communicator, etc.).  (or you do something like run "at" or "batch", which is basically using a file as a interprocess communication, and the at daemon watches the file)


time-nuts mailing list -- time-nuts@febo.com
To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
and follow the instructions there.

Hi Having done this on *very* small machines with cgi before, the lag has never been an issue. Yes, the things I do are “tweaks” to variables, or data requests. I do not try to spawn a piece of code to compute PI to 800 places and wait for the result. Bob > On Jul 6, 2015, at 10:24 PM, Jim Lux <jimlux@earthlink.net> wrote: > > On 7/6/15 3:19 PM, Tom Harris wrote: >> Since you want simple just use a CGI script written in your language of >> choice. Very easy technology to learn, Python has support libraries out of >> the box if you want. You have a webpge with carious simple controls on it >> like buttons etc, you click a special button that posts a request to a URL, >> the webserver runs a script that generates the response, the webserver >> serves it out, your browser displays it. Why bother with learning a >> framework? Messing about with mechanics is far more fun! >> >> > > > > The only hiccup with the cgi approach (and with "directly code the action in the guts of the server" like with flask) is that the subprocess that's spawned has to complete before control returns (e.g. to serve stdout to the user). So if you want to fire off a task that will run in parallel with the webserver's other stuff, you need to have some sort of interprocess communication (e.g. a named pipe, socket, file, MPI communicator, etc.). (or you do something like run "at" or "batch", which is basically using a file as a interprocess communication, and the at daemon watches the file) > > > > _______________________________________________ > time-nuts mailing list -- time-nuts@febo.com > To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts > and follow the instructions there.
JL
John Laur
Tue, Jul 7, 2015 8:34 PM

A small task queue or message queue would serve the purpose of tying the
webserver to the other external tasks: 1) Web server queues job; 2) polls
via ajax for status or they could run syncronously. Python is not my forte
but there are a number that look like they integrate very well with python.
A couple that look like they might be suitable from a quick google are huey
or celery.

John

On Tue, Jul 7, 2015 at 6:13 AM, Bob Camp kb8tq@n1k.org wrote:

Hi

Having done this on very small machines with cgi before, the lag has
never been
an issue. Yes, the things I do are “tweaks” to variables, or data
requests. I do not try
to spawn a piece of code to compute PI to 800 places and wait for the
result.

Bob

On Jul 6, 2015, at 10:24 PM, Jim Lux jimlux@earthlink.net wrote:

On 7/6/15 3:19 PM, Tom Harris wrote:

Since you want simple just use a CGI script written in your language of
choice. Very easy technology to learn, Python has support libraries out

of

the box if you want. You have a webpge with carious simple controls on

it

like buttons etc, you click a special button that posts a request to a

URL,

the webserver runs a script that generates the response, the webserver
serves it out, your browser displays it. Why bother with learning a
framework? Messing about with mechanics is far more fun!

The only hiccup with the cgi approach (and with "directly code the

action in the guts of the server" like with flask) is that the subprocess
that's spawned has to complete before control returns (e.g. to serve stdout
to the user). So if you want to fire off a task that will run in parallel
with the webserver's other stuff, you need to have some sort of
interprocess communication (e.g. a named pipe, socket, file, MPI
communicator, etc.).  (or you do something like run "at" or "batch", which
is basically using a file as a interprocess communication, and the at
daemon watches the file)


time-nuts mailing list -- time-nuts@febo.com
To unsubscribe, go to

and follow the instructions there.


time-nuts mailing list -- time-nuts@febo.com
To unsubscribe, go to
https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
and follow the instructions there.

A small task queue or message queue would serve the purpose of tying the webserver to the other external tasks: 1) Web server queues job; 2) polls via ajax for status or they could run syncronously. Python is not my forte but there are a number that look like they integrate very well with python. A couple that look like they might be suitable from a quick google are huey or celery. John On Tue, Jul 7, 2015 at 6:13 AM, Bob Camp <kb8tq@n1k.org> wrote: > Hi > > Having done this on *very* small machines with cgi before, the lag has > never been > an issue. Yes, the things I do are “tweaks” to variables, or data > requests. I do not try > to spawn a piece of code to compute PI to 800 places and wait for the > result. > > Bob > > > On Jul 6, 2015, at 10:24 PM, Jim Lux <jimlux@earthlink.net> wrote: > > > > On 7/6/15 3:19 PM, Tom Harris wrote: > >> Since you want simple just use a CGI script written in your language of > >> choice. Very easy technology to learn, Python has support libraries out > of > >> the box if you want. You have a webpge with carious simple controls on > it > >> like buttons etc, you click a special button that posts a request to a > URL, > >> the webserver runs a script that generates the response, the webserver > >> serves it out, your browser displays it. Why bother with learning a > >> framework? Messing about with mechanics is far more fun! > >> > >> > > > > > > > > The only hiccup with the cgi approach (and with "directly code the > action in the guts of the server" like with flask) is that the subprocess > that's spawned has to complete before control returns (e.g. to serve stdout > to the user). So if you want to fire off a task that will run in parallel > with the webserver's other stuff, you need to have some sort of > interprocess communication (e.g. a named pipe, socket, file, MPI > communicator, etc.). (or you do something like run "at" or "batch", which > is basically using a file as a interprocess communication, and the at > daemon watches the file) > > > > > > > > _______________________________________________ > > time-nuts mailing list -- time-nuts@febo.com > > To unsubscribe, go to > https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts > > and follow the instructions there. > > _______________________________________________ > time-nuts mailing list -- time-nuts@febo.com > To unsubscribe, go to > https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts > and follow the instructions there. >
CA
Chris Albertson
Wed, Jul 8, 2015 4:03 AM

The other complication with simple CGI BIN scripts is if you have
multiple clients eating using their own browser.  You have to manage
cookies or track IP addresses.  Or for a simple home server, just let
thing fail if a second client starts making changes

On Mon, Jul 6, 2015 at 7:24 PM, Jim Lux jimlux@earthlink.net wrote:

On 7/6/15 3:19 PM, Tom Harris wrote:

Since you want simple just use a CGI script written in your language of
choice. Very easy technology to learn, Python has support libraries out of
the box if you want. You have a webpge with carious simple controls on it
like buttons etc, you click a special button that posts a request to a
URL,
the webserver runs a script that generates the response, the webserver
serves it out, your browser displays it. Why bother with learning a
framework? Messing about with mechanics is far more fun!

The only hiccup with the cgi approach (and with "directly code the action in
the guts of the server" like with flask) is that the subprocess that's
spawned has to complete before control returns (e.g. to serve stdout to the
user). So if you want to fire off a task that will run in parallel with the
webserver's other stuff, you need to have some sort of interprocess
communication (e.g. a named pipe, socket, file, MPI communicator, etc.).
(or you do something like run "at" or "batch", which is basically using a
file as a interprocess communication, and the at daemon watches the file)


time-nuts mailing list -- time-nuts@febo.com
To unsubscribe, go to
https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
and follow the instructions there.

--

Chris Albertson
Redondo Beach, California

The other complication with simple CGI BIN scripts is if you have multiple clients eating using their own browser. You have to manage cookies or track IP addresses. Or for a simple home server, just let thing fail if a second client starts making changes On Mon, Jul 6, 2015 at 7:24 PM, Jim Lux <jimlux@earthlink.net> wrote: > On 7/6/15 3:19 PM, Tom Harris wrote: >> >> Since you want simple just use a CGI script written in your language of >> choice. Very easy technology to learn, Python has support libraries out of >> the box if you want. You have a webpge with carious simple controls on it >> like buttons etc, you click a special button that posts a request to a >> URL, >> the webserver runs a script that generates the response, the webserver >> serves it out, your browser displays it. Why bother with learning a >> framework? Messing about with mechanics is far more fun! >> >> > > > > The only hiccup with the cgi approach (and with "directly code the action in > the guts of the server" like with flask) is that the subprocess that's > spawned has to complete before control returns (e.g. to serve stdout to the > user). So if you want to fire off a task that will run in parallel with the > webserver's other stuff, you need to have some sort of interprocess > communication (e.g. a named pipe, socket, file, MPI communicator, etc.). > (or you do something like run "at" or "batch", which is basically using a > file as a interprocess communication, and the at daemon watches the file) > > > > > _______________________________________________ > time-nuts mailing list -- time-nuts@febo.com > To unsubscribe, go to > https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts > and follow the instructions there. -- Chris Albertson Redondo Beach, California
BI
Brian Inglis
Wed, Jul 8, 2015 4:59 AM

On 2015-07-04 07:13, Jim Lux wrote:

I've got a project I'm working on to make a sophisticated sundial with moving mirrors.  I've got a batch of Arduinos that move the mirrors to the appropriate places, given the current sun angle, etc.
I've got a beaglebone that runs some python code to calculate sun angle based on time
The beaglebone will have a GPS feeding it to get time.
BUT now, I'd like to add a web interface, so that it can be manipulated by a mobile device using a browser.
One way I can think of is to run some sort of limited web server. there are a couple that come with the beaglebone, including the python "simplehttpserver".
But I'm sort of stuck on the interface between the webserver and the other code running.
I've done this kind of thing where the one task goes out and updates files in the tree that's being served by the web server, and that works fine for "status display" kinds of things that don't update very quickly. It's also nicely partitioned.
but I want to be able to change the behavior of the system (e.g. by having the server respond to a PUT or something)
Is the best scheme to go in and modify the webserver code to look for specific URLs requested, and then fire off some custom code to do what I want?

May want to start with a control web page with an HTML FORM element and embedded input elements - easy even if you have not done much form design and entry implementation.
Submit target can be any URL designating a Python CGI script, which generates at least a Content-type header and HTML on stdout returned to the browser.
HTML output normally includes a copy of the original FORM (with values passed selected for editing) as well as HTML output and maybe inline or linked graphics.
You only need a web server that supports the CGI interface, with some way to configure it and say where the scripts are.
See Python cgi, html, http module docs to DIY.

--
Take care. Thanks, Brian Inglis

On 2015-07-04 07:13, Jim Lux wrote: > I've got a project I'm working on to make a sophisticated sundial with moving mirrors. I've got a batch of Arduinos that move the mirrors to the appropriate places, given the current sun angle, etc. > I've got a beaglebone that runs some python code to calculate sun angle based on time > The beaglebone will have a GPS feeding it to get time. > BUT now, I'd like to add a web interface, so that it can be manipulated by a mobile device using a browser. > One way I can think of is to run some sort of limited web server. there are a couple that come with the beaglebone, including the python "simplehttpserver". > But I'm sort of stuck on the interface between the webserver and the other code running. > I've done this kind of thing where the one task goes out and updates files in the tree that's being served by the web server, and that works fine for "status display" kinds of things that don't update very quickly. It's also nicely partitioned. > but I want to be able to change the behavior of the system (e.g. by having the server respond to a PUT or something) > Is the best scheme to go in and modify the webserver code to look for specific URLs requested, and then fire off some custom code to do what I want? May want to start with a control web page with an HTML FORM element and embedded input elements - easy even if you have not done much form design and entry implementation. Submit target can be any URL designating a Python CGI script, which generates at least a Content-type header and HTML on stdout returned to the browser. HTML output normally includes a copy of the original FORM (with values passed selected for editing) as well as HTML output and maybe inline or linked graphics. You only need a web server that supports the CGI interface, with some way to configure it and say where the scripts are. See Python cgi, html, http module docs to DIY. -- Take care. Thanks, Brian Inglis
JL
Jim Lux
Wed, Jul 8, 2015 12:55 PM

On 7/7/15 9:59 PM, Brian Inglis wrote:

On 2015-07-04 07:13, Jim Lux wrote:

I've got a project I'm working on to make a sophisticated sundial with
moving mirrors.  I've got a batch of Arduinos that move the mirrors to
the appropriate places, given the current sun angle, etc.
I've got a beaglebone that runs some python code to calculate sun
angle based on time
The beaglebone will have a GPS feeding it to get time.
BUT now, I'd like to add a web interface, so that it can be
manipulated by a mobile device using a browser.
One way I can think of is to run some sort of limited web server.
there are a couple that come with the beaglebone, including the python
"simplehttpserver".
But I'm sort of stuck on the interface between the webserver and the
other code running.
I've done this kind of thing where the one task goes out and updates
files in the tree that's being served by the web server, and that
works fine for "status display" kinds of things that don't update very
quickly. It's also nicely partitioned.
but I want to be able to change the behavior of the system (e.g. by
having the server respond to a PUT or something)
Is the best scheme to go in and modify the webserver code to look for
specific URLs requested, and then fire off some custom code to do what
I want?

May want to start with a control web page with an HTML FORM element and
embedded input elements - easy even if you have not done much form
design and entry implementation.
Submit target can be any URL designating a Python CGI script, which
generates at least a Content-type header and HTML on stdout returned to
the browser.
HTML output normally includes a copy of the original FORM (with values
passed selected for editing) as well as HTML output and maybe inline or
linked graphics.
You only need a web server that supports the CGI interface, with some
way to configure it and say where the scripts are.
See Python cgi, html, http module docs to DIY.

Yes, that seems to be the way..
The interesting thing is that the cgi needs to return reasonably fast,
or the user client will timeout, so it's not a good way to do something
that takes a long time.  Great for "put parameters in a file" or "send
short command out IO device", not so great for "start long running
process that needs to continue after user has gone on to do other things.

So it comes down to lashing up some sort of interprocess communication,
whether it's a named pipe, a file that is shared between two processes,
IP sockets, etc.

On 7/7/15 9:59 PM, Brian Inglis wrote: > On 2015-07-04 07:13, Jim Lux wrote: >> I've got a project I'm working on to make a sophisticated sundial with >> moving mirrors. I've got a batch of Arduinos that move the mirrors to >> the appropriate places, given the current sun angle, etc. >> I've got a beaglebone that runs some python code to calculate sun >> angle based on time >> The beaglebone will have a GPS feeding it to get time. >> BUT now, I'd like to add a web interface, so that it can be >> manipulated by a mobile device using a browser. >> One way I can think of is to run some sort of limited web server. >> there are a couple that come with the beaglebone, including the python >> "simplehttpserver". >> But I'm sort of stuck on the interface between the webserver and the >> other code running. >> I've done this kind of thing where the one task goes out and updates >> files in the tree that's being served by the web server, and that >> works fine for "status display" kinds of things that don't update very >> quickly. It's also nicely partitioned. >> but I want to be able to change the behavior of the system (e.g. by >> having the server respond to a PUT or something) >> Is the best scheme to go in and modify the webserver code to look for >> specific URLs requested, and then fire off some custom code to do what >> I want? > > May want to start with a control web page with an HTML FORM element and > embedded input elements - easy even if you have not done much form > design and entry implementation. > Submit target can be any URL designating a Python CGI script, which > generates at least a Content-type header and HTML on stdout returned to > the browser. > HTML output normally includes a copy of the original FORM (with values > passed selected for editing) as well as HTML output and maybe inline or > linked graphics. > You only need a web server that supports the CGI interface, with some > way to configure it and say where the scripts are. > See Python cgi, html, http module docs to DIY. > Yes, that seems to be the way.. The interesting thing is that the cgi needs to return reasonably fast, or the user client will timeout, so it's not a good way to do something that takes a long time. Great for "put parameters in a file" or "send short command out IO device", not so great for "start long running process that needs to continue after user has gone on to do other things. So it comes down to lashing up some sort of interprocess communication, whether it's a named pipe, a file that is shared between two processes, IP sockets, etc.