Jump to content

For some backstory, I'm currently taking a high school networking class and we have a toaster that is passed down to each incoming senior class. Some friends and I want to put a Raspberry Pi in the toaster and be able to control it through the computer.

What language would be best? I would assume like C# or something like that but if someone has a good recommendation that's not ungodly difficult to learn, that'd be great.

This is going to be a really dumb but cool project.

 

Raspberry Pi 4 (8GB Ram model)

Link to comment
https://linustechtips.com/topic/1331916-raspberry-pi-in-a-toaster/
Share on other sites

Link to post
Share on other sites

2 hours ago, shadow_ray said:

PI4 with 8gb ram as a toaster controller? 😄 I would use a 1$ ESP8266 chip for that.

It was meant to be overboard stupid so we could play like an emulator while making toast or something. Just as a school project lmao.

Link to post
Share on other sites

3 hours ago, EMB said:

It was meant to be overboard stupid so we could play like an emulator while making toast or something. Just as a school project lmao.

Ohh ok, got it. Python is probably the easiest to learn and it's commonly used in pi projects.

ಠ_ಠ

Link to post
Share on other sites

If it's a Raspberry Pi, just use Python. It comes preinstalled, all the libraries just work, and it's easy to learn.

 

Personally, the way I'd implement control over the network would be to write a Python script which runs the toaster once, then write a small piece of software on the client machine - potentially also with Python, or with .NET if that's your thing - which connects to the Pi over SSH and then runs the script. Hell, a batch file would do it if you don't mind it being a bit clunky (and not being able to run it on anything but Windows)

There are pre-existing libraries for SSH for a variety of languages, so that part shouldn't be too tricky.

____________________________________________________________________________________________________________________________________

 

 

____________________________________________________________________________________________________________________________________

pythonmegapixel

into tech, public transport and architecture // amateur programmer // youtuber // beginner photographer

Thanks for reading all this by the way!

By the way, my desktop is a docked laptop. Get over it, No seriously, I have an exterrnal monitor, keyboard, mouse, headset, ethernet and cooling fans all connected. Using it feels no different to a desktop, it works for several hours if the power goes out, and disconnecting just a few cables gives me something I can take on the go. There's enough power for all games I play and it even copes with basic (and some not-so-basic) video editing. Give it a go - you might just love it.

Link to post
Share on other sites

On 4/28/2021 at 10:01 AM, pythonmegapixel said:

If it's a Raspberry Pi, just use Python. It comes preinstalled, all the libraries just work, and it's easy to learn.

 

Personally, the way I'd implement control over the network would be to write a Python script which runs the toaster once, then write a small piece of software on the client machine - potentially also with Python, or with .NET if that's your thing - which connects to the Pi over SSH and then runs the script. Hell, a batch file would do it if you don't mind it being a bit clunky (and not being able to run it on anything but Windows)

There are pre-existing libraries for SSH for a variety of languages, so that part shouldn't be too tricky.

Any recommendations for a newbee to coding for Python?

Link to post
Share on other sites

2 minutes ago, EMB said:

Any recommendations for a newbee to coding for Python?

If you are already familiar with basic programming constructs - for example, if you already know Java, Javascript or a C-family language - then you can just jump in with a tutorial specific to the RPi. You'll probably pick it up fairly quickly.

 

If you want something which takes you through the basics, maybe have a look at https://www.w3schools.com/python/python_getstarted.asp

____________________________________________________________________________________________________________________________________

 

 

____________________________________________________________________________________________________________________________________

pythonmegapixel

into tech, public transport and architecture // amateur programmer // youtuber // beginner photographer

Thanks for reading all this by the way!

By the way, my desktop is a docked laptop. Get over it, No seriously, I have an exterrnal monitor, keyboard, mouse, headset, ethernet and cooling fans all connected. Using it feels no different to a desktop, it works for several hours if the power goes out, and disconnecting just a few cables gives me something I can take on the go. There's enough power for all games I play and it even copes with basic (and some not-so-basic) video editing. Give it a go - you might just love it.

Link to post
Share on other sites

14 minutes ago, pythonmegapixel said:

If you are already familiar with basic programming constructs - for example, if you already know Java, Javascript or a C-family language - then you can just jump in with a tutorial specific to the RPi. You'll probably pick it up fairly quickly.

 

If you want something which takes you through the basics, maybe have a look at https://www.w3schools.com/python/python_getstarted.asp

Cool, thanks man, you've been a great help.

I'll probably update this thread or make a new one when this project actually gets going.

Link to post
Share on other sites

  • 2 weeks later...

Python would be one of the easier languages. You could use a pi zero to do this (as well as use it to emulate) This way, you are only potentially sacrificing a $10 sbc versus a rpi 4 that costs 5 times as much.

 

I think there are a few ways to do this, but I'm still a novice when it comes to python and coding in general...

 

You could create a gui web server using a python interface called tkinter which can be accessed on your wifi network. However, for simplicity, I'd ssh into your pi to execute the .py code. As far as the coding and hardware, I'd think you would need to energize a relay which activates some kind of mechanism to load the toaster. Not exactly sure because I've never attempted this myself...lol. However, I can't picture the code being overly complicated once you understand how to utilize the gpio pins.

Link to post
Share on other sites

Python is definitely the easiest route. I'd personally setup a flask server on the pi and serve a simple control page to the browser. Display toaster status, even estimate cooking time etc. 

 

As for electronics you should probably just control the plunger considering everything else will just work and you aren't bypassing all the safety mechanisms. A pull solenoid or even an electromagnet with some ferrous metal on the plunger will do the job of a human. You could get fancy by controlling the mystical toaster dial with a stepper motor if you wanted. Just be safe.

 

Is there anywhere we can follow progress?

Link to post
Share on other sites

10 hours ago, codesidian said:

Python is definitely the easiest route. I'd personally setup a flask server on the pi and serve a simple control page to the browser. Display toaster status, even estimate cooking time etc. 

 

As for electronics you should probably just control the plunger considering everything else will just work and you aren't bypassing all the safety mechanisms. A pull solenoid or even an electromagnet with some ferrous metal on the plunger will do the job of a human. You could get fancy by controlling the mystical toaster dial with a stepper motor if you wanted. Just be safe.

 

Is there anywhere we can follow progress?

I might make some YouTube videos about it when we do it next school year (September). We have the stuff to actually record good videos.

Still have to learn Python for the project but it should be a good time.

As for your advice, thank you for that, I was thinking about a stepper motor for the dial(s).

 

If we make YouTube videos, I'll probably reply to this thread with the link.

Link to post
Share on other sites

Have you thought about maybe just using a Raspberry Pi Zero W ... it's much smaller, and has Wifi and Bluetooth functionality.  Maybe combine it with a relay board such as (there are plenty of different ones, this is just for example)  Relay Add-on for Raspberry Pi Zero

 

 

{GoofyOne's 2c worth .... which may or may not be actually worth 2c}

 

Link to post
Share on other sites

  • 3 weeks later...

Use an arduino and learn C++. If you take this route you'll succeed in life. Anyone saying use a pi with python, to control a toaster, is setting you up to be a pleb. Also multiple people have done this already, so searching "arduino toaster" may be of use.

Link to post
Share on other sites

On 6/5/2021 at 1:11 AM, Deflowerer said:

Use an arduino and learn C++. If you take this route you'll succeed in life. Anyone saying use a pi with python, to control a toaster, is setting you up to be a pleb.

I wondered how long it would take for that kind of comment to appear on this thread. The "if you build an embedded system and don't use the lowest level language on the least abstracted hardware possible then you are a failure". I'm sorry but it's just a complete fallacy. We live in 2021, where complete computers which can competently run an entire Linux distribution now fit it in a space barely larger than the average credit card, while being mass-produced cheaply enough to profitably sell for just a few dollars. With that kind of hardware available to you, why wouldn't you make use of it?

 

Now, I'm not saying that ultra-efficient systems don't still have their place. People using tools which are too high-level for the task at hand undoubtedly cause some of the poor-quality clunky-feeling systems that we get these days.  And when someone is being paid good money to build something that will be used by thousands of people, I think it is reasonable to expect that what they build will be reasonably efficient. But OP is not a professional programmer designing a UI that thousands of people will have to use. They have said that their aim is to just produce something cool with the items they have available in their high-school class. 

 

I know several people who program in a variety of languages, and almost all of them - myself included - started off just bodging stuff together in Python (or hell, even Scratch!). Until you get to the point where you are being paid to do it as a career, there is nothing wrong with doing that, and people who do it are certainly not worthy of being called plebs.

____________________________________________________________________________________________________________________________________

 

 

____________________________________________________________________________________________________________________________________

pythonmegapixel

into tech, public transport and architecture // amateur programmer // youtuber // beginner photographer

Thanks for reading all this by the way!

By the way, my desktop is a docked laptop. Get over it, No seriously, I have an exterrnal monitor, keyboard, mouse, headset, ethernet and cooling fans all connected. Using it feels no different to a desktop, it works for several hours if the power goes out, and disconnecting just a few cables gives me something I can take on the go. There's enough power for all games I play and it even copes with basic (and some not-so-basic) video editing. Give it a go - you might just love it.

Link to post
Share on other sites

On 4/27/2021 at 7:40 PM, EMB said:

For some backstory, I'm currently taking a high school networking class and we have a toaster that is passed down to each incoming senior class. Some friends and I want to put a Raspberry Pi in the toaster and be able to control it through the computer.

What language would be best? I would assume like C# or something like that but if someone has a good recommendation that's not ungodly difficult to learn, that'd be great.

This is going to be a really dumb but cool project.

 

Raspberry Pi 4 (8GB Ram model)

Python with "gpiozero" library would be the best 

Link to post
Share on other sites

The easiest is just python with gpiozero. It comes baked into RaspberryPi OS. An arduino is somewhat better for many tasks (including this one). It is also orders of magnitude more difficult for what you are trying to do.

Just to be clear, @Deflowerer is right, a raspberry pi running a full blown OS is overkill for what you are likely trying to do.

But he's wrong in the sense that it sets you up for failure. @Deflowerer forgot to account for the effort required in spinning up new knowledge. Real life engineering is about balancing costs with desired end results. Having to learn a new language (and a host of other things that go along with WiFi based networking while running essentially baremetal) is extremely expensive in terms of time and effort. It is less than 100 lines in python to make probably one of the nicest Commercial-Off-The-Shelf toaster interfaces in existence.

Since OP is working on a publicly announced project that is part of a long standing tradition, they cannot fail or be partially complete. So my vote is to take the easiest way, because it costs you nothing here: Use a raspberryPi loaded with RaspberryPi OS, and write your code in python with the gpiozero library.

ENCRYPTION IS NOT A CRIME

Link to post
Share on other sites

On 6/5/2021 at 2:11 AM, Deflowerer said:

Use an arduino and learn C++. If you take this route you'll succeed in life. Anyone saying use a pi with python, to control a toaster, is setting you up to be a pleb. Also multiple people have done this already, so searching "arduino toaster" may be of use.

A "pleb"? Seriously? Just google an average Python developer's salary.

 

An average employer does not care of what old neckbeards have to say, what they care about is how to spend at little man-hours as possible while delivering the result which is acceptable, and Python is perfect for that.

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×