Open sjappleton opened 5 years ago
Hi sjappleton, I haven’t looked at this code for awhile.
The build I am currently running on my Silvia-Pi with Kivy is multithreaded. I’m currently in the middle of no where so I’ll take a look when I can get on my comp.
However, if I was to do this again I wouldn’t use Kivy, I’d use a node.js setup or something, just makes building the GUI quicker with less code. Kivy I found to be temperamental...
Hi Thanks for the response.
I would love to see that when possible. No worries about the time I have been messing with my Gaggia for several months so I am in no hurry. I understand the point on Kivy it is quite difficult to play with. I like the result as I like the touchscreen controls.
Cheers
You’re welcome, I’ll check it out when I get home and let you know.
Any chance you have been able to look at that multi threading?
hey mate, sorry about the late reply. I'll have a look now.
Hey Sjappleton, unfortunately my HDs that I kept all my old stuff on is back in Australia. And I'm not going to be back for a couple of months. In these tuts I didn't include the multithreaded part and I always intended on doing another tutorial on it.
But to be honest threading is super easy to implement in python, I can help you if you like:
follow this:
Out of interest, where are you currently at on your project? what is the complete intent/plan?
I would appreciate that. I have a Gaggia Classic Espresso machine that I am modifying. End goal is a touch screen PID controlled espresso machine with shot timer. I have the basic Kivy screen designed with the shot timer and relays working but I am having difficulty incorporating the PID control/temperature without things really slowing down. I will then be mounting the raspberry pi touchscreen unit to my espresso machine with a teak wood facade and custom wood handles for the steam and portafilter.
I will post what I have. I am a mechanical engineer with background in controls and the electrical side but my coding skills are pretty amateur at best.
Perfect. Yeah post what you have including photos, I am interested to see what it looks like so far.
Couple of questions:
Yes using the RPi and 7” RPi touchscreen.
SSR relay for the heater and pump which are actually switching from my kivy program.
Not sure, I do not have it in there now but might want to add it to a separate screen.
From: De-Man [mailto:notifications@github.com] Sent: September-04-19 5:56 AM To: De-Man/silvia-pi Cc: Sean Appleton; Author Subject: Re: [De-Man/silvia-pi] Multithreading (#1)
Perfect. Yeah post what you have including photos, I am interested to see what it looks like so far.
Couple of questions:
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/De-Man/silvia-pi/issues/1?email_source=notifications&email_token=AGG6TKL3CQBVVH4D6OVC5JLQH6O3RA5CNFSM4H5BP6UKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD53KBNA#issuecomment-527868084, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AGG6TKNUX7WSMM3D5YT22HLQH6O3RANCNFSM4H5BP6UA.
Real time plotting helps tuning the controller much easier, so something worth thinking about. It also looks cool on you touch screen.
I only used a single SSR for the heating element as the controller can switch it on an off beyond a typical solenoid relay's design capability. So I question whether or not you need an SSR for the pump?
Well let me know what specifically you want a hand with and I will try to help as much as I can.
I will get you pictures as well this weekend but wanted to show the code such as it is.
I think I got all the components and gui working but I am having trouble getting the controller to work in the background
Test of gui and rtd temp sensor.
-------- Original message -------- From: De-Man notifications@github.com Date: 2019-09-05 12:27 AM (GMT-06:00) To: De-Man/silvia-pi silvia-pi@noreply.github.com Cc: Sean Appleton SAppleton@qmplastics.com, Author author@noreply.github.com Subject: Re: [De-Man/silvia-pi] Multithreading (#1)
Real time plotting helps tuning the controller much easier, so something worth thinking about. It also looks cool on you touch screen.
I only used a single SSR for the heating element as the controller can switch it on an off beyond a typical solenoid relay's design capability. So I question whether or not you need an SSR for the pump?
Well let me know what specifically you want a hand with and I will try to help as much as I can.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/De-Man/silvia-pi/issues/1?email_source=notifications&email_token=AGG6TKIYGI4UIS6FXJRUFUDQICRDTA5CNFSM4H5BP6UKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD557P4I#issuecomment-528218097, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AGG6TKJ32K3OC7LG6O32J7LQICRDTANCNFSM4H5BP6UA.
Hello,
Any chance you took a look at the code? I know it is not great but I am looking to get it working and any help would be appreciated.
Thanks Sean
-------- Original message -------- From: Sean Appleton SAppleton@qmplastics.com Date: 2019-09-05 9:07 PM (GMT-06:00) To: De-Man/silvia-pi reply@reply.github.com, De-Man/silvia-pi silvia-pi@noreply.github.com Cc: Author author@noreply.github.com Subject: Re: [De-Man/silvia-pi] Multithreading (#1)
Test of gui and rtd temp sensor.
-------- Original message -------- From: De-Man notifications@github.com Date: 2019-09-05 12:27 AM (GMT-06:00) To: De-Man/silvia-pi silvia-pi@noreply.github.com Cc: Sean Appleton SAppleton@qmplastics.com, Author author@noreply.github.com Subject: Re: [De-Man/silvia-pi] Multithreading (#1)
Real time plotting helps tuning the controller much easier, so something worth thinking about. It also looks cool on you touch screen.
I only used a single SSR for the heating element as the controller can switch it on an off beyond a typical solenoid relay's design capability. So I question whether or not you need an SSR for the pump?
Well let me know what specifically you want a hand with and I will try to help as much as I can.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/De-Man/silvia-pi/issues/1?email_source=notifications&email_token=AGG6TKIYGI4UIS6FXJRUFUDQICRDTA5CNFSM4H5BP6UKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD557P4I#issuecomment-528218097, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AGG6TKJ32K3OC7LG6O32J7LQICRDTANCNFSM4H5BP6UA.
Hi sjappleton, my apologies for my tardy-ness here. I have had a quick skim through it. I haven't had a chance to run it yet.
If you can give me 2 weeks I will be back in Oz and I can just give you my code?
Hi,
No problem. I appreciate the help and I have no issues waiting.
Cheers
From: De-Man [mailto:notifications@github.com] Sent: October-07-19 9:05 AM To: De-Man/silvia-pi Cc: Sean Appleton; Author Subject: Re: [De-Man/silvia-pi] Multithreading (#1)
Hi sjappleton, my apologies for my tardy-ness here. I have had a quick skim through it. I haven't had a chance to run it yet.
If you can give me 2 weeks I will be back in Oz and I can just give you my code?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/De-Man/silvia-pi/issues/1?email_source=notifications&email_token=AGG6TKNT6UOBCGZG5ITGTULQNNF2BA5CNFSM4H5BP6UKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEAQVT5Q#issuecomment-539056630, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AGG6TKNIXLOOYPNTSUORSODQNNF2BANCNFSM4H5BP6UA.
Hi
I have sent you the link to the private repo for the code I am currently running on my Silvia.
Let me know if you have any queries.
Thanks I really appreciate it. I will try it out soon as I can.
See the pictures of the teak wood front mount for the rpi and new custom portafilter handle i have been building.
Cheers
-------- Original message -------- From: De-Man notifications@github.com Date: 2019-11-03 4:05 AM (GMT-06:00) To: De-Man/silvia-pi silvia-pi@noreply.github.com Cc: Sean Appleton SAppleton@qmplastics.com, Author author@noreply.github.com Subject: Re: [De-Man/silvia-pi] Multithreading (#1)
Hi
I have sent you the link to the private repo for the code I am currently running on my Silvia.
Let me know if you have any queries.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/De-Man/silvia-pi/issues/1?email_source=notifications&email_token=AGG6TKK2G27UTYZT7L4RFA3QR2O5VA5CNFSM4H5BP6UKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEC5O4HI#issuecomment-549121565, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AGG6TKIMDVP3TLSDLNAR6R3QR2O5VANCNFSM4H5BP6UA.
No probs at all.
Sorry, no pictures were showing?
So I am looking at plotter25.py and it looks like I will have to adjust the temperature as I am getting it from a max31865. Besides that I am guess I can just install this onto the RPI.
Here are the images.
I have the screen and rpi mounted and am trying to implement the program but getting an error from kivy saying it cannot find root.kv? I have kivy and garden is there another prerequisite I am missing?
-------- Original message -------- From: De-Man notifications@github.com Date: 2019-11-03 4:26 AM (GMT-06:00) To: De-Man/silvia-pi silvia-pi@noreply.github.com Cc: Sean Appleton SAppleton@qmplastics.com, Author author@noreply.github.com Subject: Re: [De-Man/silvia-pi] Multithreading (#1)
No probs at all.
Sorry, no pictures were showing?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/De-Man/silvia-pi/issues/1?email_source=notifications&email_token=AGG6TKJAFUXTCIOERMKIQBTQR2RMRA5CNFSM4H5BP6UKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEC5PHJA#issuecomment-549122980, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AGG6TKKEDCITWAKAZ7MD4MTQR2RMRANCNFSM4H5BP6UA.
Hi Sjappleton
Dan here. This is all looking amazing. Well done. Love the pictures. I am going to re-open this thread so I can try help you out (plus this is the public repo, others can't see the plotter25 repo), I'll make it public once I sanitise it and I'll add it to this repo. So please continue to post your issue here. Feel free to move your root.kv issue in to a new issue in this repo.
For this:
So I am looking at plotter25.py and it looks like I will have to adjust the temperature as I am getting it from a max31865. Besides that I am guess I can just install this onto the RPI.
Can you please answer the following as it doesn't look like you are getting temperature readings:
$/sys/bus/w1/devices
the device folder was for me (this I expect to be different for you), this may be a reason why you temp isn't being read and the graph is flat:
3b-000000191766
Thank you
Dan
So I am looking at plotter25.py and it looks like I will have to adjust the temperature as I am getting it from a max31865. Besides that I am guess I can just install this onto the RPI.
Yes there was an additional file (root.kv), and unfortunately I'm no where near my machine to pull it off of it (poor file management on my behalf - forgive me).
Comment out root.kv this was a tacky way to load up the background at the time. From what I can see from your other photos the background isn't being loaded up (I have inserted your image from the other repo above so others can see - looking good!).
To load up the background use the following:
def build(self): # From Tutorial 1
# Tutorial 2 step 3
root = FloatLayout()
# Tutorial 2 step 1
# this ensures on size and position changes the background changes accordingly
root.bind(size=self._update_rect, pos=self._update_rect)
# this ensures on build of the app the backgound is initiated 'before' anything else
with root.canvas.before:
self.rect = Rectangle(size=root.size, pos=root.pos, source='Background.png')
...
Specifically this:
with root.canvas.before:
self.rect = Rectangle(size=root.size, pos=root.pos, source='Background.png')
Make sure you do it near the top of def build(self):
.
That makes sense I will continue to post here.
I am using a pt100 with the max31865. I like it's performance and used it on a rpi controlled meat smoker I built.
I probably made an error in that. I will take a look and I added a branch for my modification using a little program that I had from someone when i made the smoker.
-------- Original message -------- From: De-Man notifications@github.com Date: 2019-11-16 7:16 AM (GMT-06:00) To: De-Man/silvia-pi silvia-pi@noreply.github.com Cc: Sean Appleton SAppleton@qmplastics.com, State change state_change@noreply.github.com Subject: Re: [De-Man/silvia-pi] Multithreading (#1)
Hi Sjappleton
This is all looking amazing. Well done. Love the pictures. I am going to re-open this thread so I can try help you out (plus this is the public repo, others can't see the plotter25 repo), I'll make it public once I sanitise it and I'll add it to this repo. So please continue to post your issue here. Feel free to move your root.kv issue in to a new issue in this repo.
For this:
So I am looking at plotter25.py and it looks like I will have to adjust the temperature as I am getting it from a max31865. Besides that I am guess I can just install this onto the RPI.
Can answer the following as it doesn't look like you are getting temperature readings:
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHubhttps://github.com/De-Man/silvia-pi/issues/1?email_source=notifications&email_token=AGG6TKKZMTB23CHLWLZ6J3LQT7XDVA5CNFSM4H5BP6UKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEEHRJTI#issuecomment-554636493, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AGG6TKMZ5V3K26F55WTGDKTQT7XDVANCNFSM4H5BP6UA.
That makes sense I will continue to post here. I am using a pt100 with the max31865. I like it's performance and used it on a rpi controlled meat smoker I built. I probably made an error in that. I will take a look and I added a branch for my modification using a little program that I had from someone when i made the smoker.
Yeah, so the current problems I see:
once you get 1. & 2. sorted it will be interesting to see how the multithreaded temp reading performs.
Getting something odd now and not sure what I did. Now seeing an error that says typeError: object.init() takes no parameters.
Very strange as I cannot get it back to what I had before.
Any thoughts?
are you able to share your code? sounds like you're trying to initiate an object with parameters?
I will as soon as I get back home from work. The only thing I have been trying to do is to get this working with the max31865.
Must of done something stupid.
From: De-Man [mailto:notifications@github.com] Sent: November-18-19 1:42 PM To: De-Man/silvia-pi Cc: Sean Appleton; State change Subject: Re: [De-Man/silvia-pi] Multithreading (#1)
are you able to share your code? sounds like you're trying to initiate an object with parameters?
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHubhttps://github.com/De-Man/silvia-pi/issues/1?email_source=notifications&email_token=AGG6TKNKZ5734XEMJZODJYTQULVX7A5CNFSM4H5BP6UKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEELVH3A#issuecomment-555176940, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AGG6TKPBQL3BRE3HHUTKC7TQULVX7ANCNFSM4H5BP6UA.
I updated the for-sjappleton code with what I had
I think i had an issue with my kivy garden and python. Using python2.7 it worked again but just need to correct the display so i can see the set point temp, timer and temp etc.
Do you have a image of what your plotter25 looks like when everything is working?
-------- Original message -------- From: De-Man notifications@github.com Date: 2019-11-18 1:42 PM (GMT-06:00) To: De-Man/silvia-pi silvia-pi@noreply.github.com Cc: Sean Appleton SAppleton@qmplastics.com, State change state_change@noreply.github.com Subject: Re: [De-Man/silvia-pi] Multithreading (#1)
are you able to share your code? sounds like you're trying to initiate an object with parameters?
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHubhttps://github.com/De-Man/silvia-pi/issues/1?email_source=notifications&email_token=AGG6TKNKZ5734XEMJZODJYTQULVX7A5CNFSM4H5BP6UKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEELVH3A#issuecomment-555176940, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AGG6TKPBQL3BRE3HHUTKC7TQULVX7ANCNFSM4H5BP6UA.
I got the temps displaying and within .6 degrees of another temp sensor. Was responding pretty quickly and handled 20 to 100 degrees. Need some work yet but getting there.
Perfect, this is looking good. You need to load the background up so you can see everything.
Worth checking the following is working:
Good to hear the temp lag is good. I wouldn't be surprised if the PT100 RTD is more accurate than the other temp probe you are using. Temperature accuracy really isn't the big thing here it is repeatability and the controller working consistently to the temp probe, which on my machine it is perfect.
See attached for the PDF tutorial (Linux Format Magazine - what this repo was for). You can see what it looks like in there on the Rancilio Silvia. I started building another cool screen GUI (hitchhikers guide to the galaxy themed - it was amazing) for this 3 years ago then my hard drive fried itself and I lost everything. Seeing you have taken interest in this - may inspire me to start over.
Made some progress and updated the branch I have modified including some new icons and attempting to bind the coffee button to pin 17 to control the relay. I am still having issues getting it to shutdown and restart. So far everything I try it just freezes, even removed the need for sudo password for shutdown. Any thoughts
I have the pump and heater working now from the relays. I added some GPIO commands to the timer code.
Just going to disassemble the test unit to clean and finish the wood and metal before final assembly. Still outstanding is to test the scheduler and get the power options working.
Are you able to load the background. That black background wasn’t doing the original icon sets any justice.
Once you get the background sorted it will look much better.
I will try a background. The new buttons actually looked quite nice on the black but I might try a white background yet.
Need to get the power options working first.
From: De-Man [mailto:notifications@github.com] Sent: November-25-19 8:41 AM To: De-Man/silvia-pi Cc: Sean Appleton; State change Subject: Re: [De-Man/silvia-pi] Multithreading (#1)
Are you able to load the background. That black background wasn’t doing the original icon sets any justice.
Once you get the background sorted it will look much better.
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHubhttps://github.com/De-Man/silvia-pi/issues/1?email_source=notifications&email_token=AGG6TKLDUZC3F7SLXS6PZWDQVPPXDA5CNFSM4H5BP6UKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEFCTVZY#issuecomment-558185191, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AGG6TKLCVKG3IAGHKN2HBDDQVPPXDANCNFSM4H5BP6UA.
Success. I got it working now and tested the water temp control, graph/setpoints, shutdown and restart. Tomorrow I will try making a couple shots with it.
A couple things still need to be addressed.
1) I need to do something to ensure the PID tuning takes into account the fact that the sensor detects the boiler wall temp and not the water temp directly. As the temp quickly spikes when the heaters are since the sensor is embedded into the boiler wall and then settles to the water temp.
2) Not sure what to do with the sleep/wake functions. Looks like they were unfinished, but would it work to to change the Coffee set point to 0? I will have to look at how to dim the screen as well.
Thanks again for all the help so far.
You are most welcome.
so were you able to sort out the background in the end?
on your point (1.): this is exactly the same as the Silvia. Therefore the controller should be able to take this into consideration. You should really only need to play with the PID coefficients and the PWM duty cycle.
On your point (2.): the sleep wake functions accessed from the power menu were never finished off, all the variables are there you just need to build the logic into it. All the hard parts are done. HArd parts being: kivy date logic and formatting, it was time consuming to get it right from memory 3-4 years ago...
In the end I went without a background, just personal preference but I like the black. I am working on the tuning but it is getting there on the tuning so far it is actually doing a decent job it is just different to look at consider some spikes you see on the graph as the al heats up quickly and then cools to the water temp.
At this time I think I am just skipping the sleep mode, currently I just use it to exit the app.
I just need one little glitch to clear up. I made the app start on boot but my graph does something funky about 10seconds where it puts in a straight line and then disappears except for a small portion. The interesting part this only happens when powering on and not restarting. I think I need the delay running the script for say 15 seconds to allow the PI to fully boot etc.
From: De-Man [mailto:notifications@github.com] Sent: December-02-19 7:23 AM To: De-Man/silvia-pi Cc: Sean Appleton; State change Subject: Re: [De-Man/silvia-pi] Multithreading (#1)
You are most welcome.
so were you able to sort out the background in the end?
on your point (1.): this is exactly the same as the Silvia. Therefore the controller should be able to take this into consideration. You should really only need to play with the PID coefficients and the PWM duty cycle.
On your point (2.): the sleep wake functions accessed from the power menu were never finished off, all the variables are there you just need to build the logic into it. All the hard parts are done. HArd parts being: kivy date logic and formatting, it was time consuming to get it right from memory 3-4 years ago...
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHubhttps://github.com/De-Man/silvia-pi/issues/1?email_source=notifications&email_token=AGG6TKJSCP52G72QZSQTJZTQWUD4HA5CNFSM4H5BP6UKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEFTPCQY#issuecomment-560394563, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AGG6TKPXBF546XLWW47HYMTQWUD4HANCNFSM4H5BP6UA.
Yes correct, you will need to add a 10 to 20 second delay before starting up the app. I had the same issue.
Is that just using Sleep 20 or something else?
Sean
From: De-Man [mailto:notifications@github.com] Sent: December-02-19 1:33 PM To: De-Man/silvia-pi Cc: Sean Appleton; State change Subject: Re: [De-Man/silvia-pi] Multithreading (#1)
Yes correct, you will need to add a 10 to 20 second delay before starting up the app. I had the same issue.
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHubhttps://github.com/De-Man/silvia-pi/issues/1?email_source=notifications&email_token=AGG6TKPH3VPY2BF55DXQJOTQWVPFLA5CNFSM4H5BP6UKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEFUUDPA#issuecomment-560546236, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AGG6TKN43GINCAXRLHN5733QWVPFLANCNFSM4H5BP6UA.
Will you be adding the multi threading still to this code? I am trying to build something similar but have not been able to get it to multi thread correctly with Kivy.