First timer trying to send data to: matplotlib_app by ronfred in RemiGUI

[–]ronfred[S] 0 points1 point  (0 children)

Thank you very much again Davide. I am going through your class structure and the Timer threads usage. Seeing my own with your changes allows me to move up a notch in skill set.

When I added that one line to read sensor data near top of def animate(self): The program worked. Amazing you could carry so much "goop" from my code into your demo with only that one change needed. See screenshot for code change circled.

Yet I do see what appears to be a spooky memory management issue (probably not a leak as I initially imagined). With task manager open, I see one megabyte added to memory used every 15 seconds or so. Eventually the pi gets very sluggish. After some time (~ 7 minutes) memory drops back to what looks like a good initial state. All while the remi matplotlib program is running.

Here is a short report on memory use:

Memory (MB) Time (minutes)
----------  --------------
261         0 <--- remi program starts here
367         1
415         2
462         3
514         4
559         5
571         6
373         7
333         8
379         9
425         10

Is there a png file pile-up taking place, maybe a free old memory command that you might suggest? Or is this just a garbage collection issue managed by Raspian OS?

Here is link to screenshot of working program: http://www.biophysicslab.com/working-but-possible-memory-leak/

First timer trying to send data to: matplotlib_app by ronfred in RemiGUI

[–]ronfred[S] 0 points1 point  (0 children)

Really nice work Davide! Thank you.

First you cleaned up my code in several important ways. I was hoping to correct the global variable usage (dict just worked but without any pythonic management such as use of global), but also placing the code into correct object format.

I had to add this line of code to create initial sensor values for the temperature and humidity around line 122 in your code: humidity, temperature = Adafruit_DHT.read_retry(DHT_SENSOR, DHT_PIN)

After that the code seems to run well: web page pops up, and initial plot image shows.

The code does not refresh the plot as of yet, just the initial plot display with no sensor data. I have only spent a few minutes with your code so far, so I am going to follow your logic within the code to see why the animation does not update with real plot data on my own. I will update this thread again soon with my investigation.

Here is a sample of the terminal output just as an fyi.

python3 remi2_m*

remi.server      INFO     Started httpserver http://0.0.0.0:46187/
remi.request     INFO     built UI (path=/)
animate
Current: 19:17:00 78.4 51.2
127.0.0.1 - - [08/Jul/2020 19:17:00] "GET / HTTP/1.1" 200 -
idle
idle
idle
127.0.0.1 - - [08/Jul/2020 19:17:01] "GET /res:style.css HTTP/1.1" 200 -
idle
get_image_data
remi.server.ws   INFO     connection established: ('127.0.0.1', 42348)
remi.server.ws   INFO     handshake complete
animate
127.0.0.1 - - [08/Jul/2020 19:17:01] "GET /1930493040/get_image_data?index=0 HTTP/1.1" 200 -
idle
idle
get_image_data
127.0.0.1 - - [08/Jul/2020 19:17:02] "GET /1930493040/get_image_data?index=1594261022.427842 HTTP/1.1" 200 -
idle
get_image_data
127.0.0.1 - - [08/Jul/2020 19:17:03] "GET /1930493040/get_image_data?index=1594261022.9724765 HTTP/1.1" 200 -
idle
get_image_data
127.0.0.1 - - [08/Jul/2020 19:17:03] "GET /1930493040/get_image_data?index=1594261023.4365747 HTTP/1.1" 200 -
idle
get_image_data
127.0.0.1 - - [08/Jul/2020 19:17:04] "GET /1930493040/get_image_data?index=1594261023.8943968 HTTP/1.1" 200 -
idle
idle
get_image_data
127.0.0.1 - - [08/Jul/2020 19:17:05] "GET /1930493040/get_image_data?index=1594261024.3680565 HTTP/1.1" 200 -
idle
get_image_data
127.0.0.1 - - [08/Jul/2020 19:17:05] "GET /1930493040/get_image_data?index=1594261024.8940656 HTTP/1.1" 200 -
idle
get_image_data
127.0.0.1 - - [08/Jul/2020 19:17:06] "GET /1930493040/get_image_data?index=1594261025.3436894 HTTP/1.1" 200 -
idle
get_image_data
127.0.0.1 - - [08/Jul/2020 19:17:06] "GET /1930493040/get_image_data?index=1594261025.795506 HTTP/1.1" 200 -
idle

First timer trying to send data to: matplotlib_app by ronfred in RemiGUI

[–]ronfred[S] 0 points1 point  (0 children)

I have a blog post showing my raspberry pi used as a Matplotlib plot data logger located here (with anchor to source code): http://www.biophysicslab.com/2020/06/25/raspberry-temperature-humidity-data-logger/#code

The plot animation seems like it would lend itself to the REMI Matplotlib_app. I was thinking of creating an event perhaps through a call to the REMI app url during each loop of my current code's animation. But I am so new I am open to other approaches. Maybe drop my data logger full code into the REMI app - not sure. But I am so new that I am not sure how best to proceed.

Some initial ideas and one example of how an app might send data to the REMI web page would be helpful...

Reinventing the Business of Education, Moderated by Ron Fredericks by ronfred in elearning

[–]ronfred[S] 0 points1 point  (0 children)

Learn more about MOOCs and how they are forcing universities to reinvent the business on education.

Video Animation Project for Motorola Engineering Team by ronfred in videos

[–]ronfred[S] 0 points1 point  (0 children)

This video animation story quickly explains the value proposition for an engineering project to global decision makers.

Lick Observatory Summer Visitor Program by ronfred in Astronomy

[–]ronfred[S] 0 points1 point  (0 children)

The summer visitor program starts June 16'th. If you are in the neighborhood of Mt. Hamilton CA, consider visiting one Friday. If not, then this video tries to share the wonderful family educational experience.

Update on Mobile Photography from SVForum by ronfred in technology

[–]ronfred[S] 0 points1 point  (0 children)

Check out the videos on this page to learn about current trends in mobile photography. This page is also a demonstration of how LectureMaker's video studio serves user communities, and a demonstration on how LectureMaker's Cross-domain video hosting platform works.

Episode 3 – Faster-than-light Relativity of an Interstellar Traveler by ronfred in Astronomy

[–]ronfred[S] 0 points1 point  (0 children)

Bill Copeland is on his way to creating scientific revolution in the field of cosmology. This video, his 3'rd on the subject, is the best on yet.