Custom heated bed control

i made a custom heated bed for my da vinci mini w+. i made it with an arduino, a silicone heating mat and a relay (ofc because the mat takes 12v 10a) . i would like to know if there would be a way to controll the arduino / tempreture of the mat with octoprint (im new to octoprint so idk if there is a way to access the usb pins because if there was i would be able to send data to the arduino with the serial interface )

I know i can just use gpio pins to control the relay and get data from the thermistor but i already codded it for the arduino and dont want to code it again lol (did all the conversions for the thermistor to C). i would also like to know if there would be a very easy way to just get all the data directly from the arduino (so that way i could see the temperature on the gui )

im running the latest version of octoPrint and latest version on my printer.

Well a very easy way would be to put marlin on the arduino and to use a second Octoprint instance on the pi for it.
Of course you wouldn't be able to control it with the print job - but it would be quick and easy :man_shrugging:
You could power the bed and arduino on via a gpio controlled relay, set the temperature in the second instance then start the print in the first instance.
Turning the relay on and off could be done with something like the PSU Control plugin.

I have the arduino only to control the heated mat, so why would I put g-code on it ?

Because you can easily connect it with Octoprint and it got everything build in - the heating algorithm, the temperature runaway protection etc.
It's just what I would do.

But the arduino can’t read G-code lmao

You asked for "a very easy way" and @PrintedWeezl offered one.

OctoPrint is expecting the printer hardware to ALL be controlled by the firmware. The firmware is expected to communicate with a serial (over USB) connection and is expected to accept gcode and respond over the same serial connection.

Since your bed heater is NOT controlled by the firmware in the printer, there isn't "a very easy way" to integrate it into OctoPrint.

You will need to write a plugin for OctoPrint that intercepts the gcode commands to set the bed temperature and the gcode commands that ask for the bed temperature (I think it will be hard to implement auto temperature reporting, but manual reporting should be doable). This plugin will then communicate with the Arduino over a separate serial (over USB) port to send / receive the temperature information.

Writing an OctoPrint plugin is well documented. The only concern I would have is whether the time it takes to send / get the information from the Arduino would cause problems with the timing expectations within OctoPrint.

1 Like

no where on that link it says where to even get started (i know how to code obv but it is different when u are working with an api). and on here : https://docs.octoprint.org/en/master/plugins/gettingstarted.html there is no file dir : ~/devel , and it is made for version 1.3 not 1.6

I assumed that you have OctoPrint installed on a Raspberry Pi. While setting up a development environment is not spelled out on that page, the !Note says it isn't absolutely necessary.

When I read that page, under !Important I see "OctoPrint 1.3.0 and up" and in my mind, 1.6 is "and up".

I wrote my first plugin by following the tutorial. If you make the effort to do this yourself and fail, you can come back here or to Discord and ask questions. The more specific / detailed your question(s), the better the answer(s).

You could do that or write a plugin as @b-morgan suggested.

What about

Seems like it would do the trick? Obviously you aren't controlling the enclosure heater, but the bed one. No difference other than the naming of it, so it should work. Connecting up a relay to the Pi should work. Not sure what you will do with your Arduino, but if you already have half a custom solution then you will have to work out the other half as well (OctoPrint plugin or something), since no one else has done it before like that.