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.