ESP8266 Controlled Display Project Log
-
I'm currently working on adding an LCD to my printer. I've read a bit about the pins being available on the board but no firmware support and I lack the knowledge to change the firmware so I'm doing the next best thing!
I'm going to attach that LCD to an ESP8266 and use the HTTP commands to control the printer, the only connection to the Duet will be power/ground. So far I've got to the point where I can parse status 1 and 2, print those values to serial, and turn the fan on/off based off axis position - no real use yet I was just testing reading values and sending g-code.
I have built a torch height control for my plasma cutter with a similar display but I really struggled with making a menu in Arduino - if you are interested in seeing how I did it go here and for a video of it in action go here and an older video of navigating/working the display before I added more values is here.
Once I get it working I'll roll a pcb to allow easy attachment to the display, here's the board for the plasma cutter
I'm doing this because I would like to learn more about the ESP8266 and it seems like a cheap solution to getting a cheap LCD working with the Duet without firmware/hardware changes. If anyone is interested in helping with the LCD, JSON parsing, or just the project in general please let me know!
-
I've hit a bit of a road block on how to handle variable length replies like those that come from http://printerip/rr_filelist?dir= or http://printerip/rr_filelist?dir=gcodes since both of these replies will depend on how many directories you have created and how many files you have currently uploaded.
I've found this on the ArduinoJSON FAQ which basically says to throw memory at the buffersize if you are unsure of what the response will be but that seems a bit wasteful considering how big some of the status replies are and the buffer they will need. Does anyone know of a better way to handle parsing the response?
Here is the response from my printer for http://printerip/rr_filelist?dir=gcodes
{"dir":"gcodes","first":0,"files":[{"type":"f","name":"TBW_Flexi_Raptor_STRONGER_TAIL.gcode","size":2620957,"date":"2018-09-10T18:03:09"},{"type":"f","name":"22TBW_Flexi_Raptor_STRONGER_TAIL.gcode","size":2602499,"date":"2018-09-10T18:13:03"},{"type":"f","name":"TBW_Vase_3_plein.gcode","size":4837255,"date":"2018-09-10T18:18:14"},{"type":"f","name":"11TBW_Vase_3_plein.gcode","size":6307976,"date":"2018-09-10T18:21:14"},{"type":"f","name":"22TBW_Vase_3_plein.gcode","size":6287451,"date":"2018-09-10T18:23:02"},{"type":"f","name":"33TBW_Vase_3_plein.gcode","size":6299392,"date":"2018-09-10T18:49:08"},{"type":"f","name":"aTBW_Vase_3_plein.gcode","size":1323013,"date":"2018-09-10T21:53:10"},{"type":"f","name":"TBW_Innofil3D_Vase.gcode","size":961010,"date":"2018-09-11T16:38:12"},{"type":"f","name":"11Innofil3D_Vase.gcode","size":849777,"date":"2018-09-11T17:02:11"},{"type":"f","name":"123Innofil3D_Vase.gcode","size":1522264,"date":"2018-09-11T17:22:00"},{"type":"f","name":"Subaru_logo_keychain_Cut_stars.gcode","size":840911,"date":"2018-09-11T20:42:09"},{"type":"f","name":"Subaru.gcode","size":233457,"date":"2018-09-11T20:59:22"},{"type":"f","name":"2Subaru.gcode","size":233676,"date":"2018-09-11T21:02:02"},{"type":"f","name":"Coral_Wavey_Vase.gcode","size":43953160,"date":"2018-09-12T16:16:07"},{"type":"f","name":"New_Coral_Vase.gcode","size":43951423,"date":"2018-09-12T16:21:20"},{"type":"f","name":"ExtuderIndictor.gcode","size":276554,"date":"2018-09-13T20:12:13"},{"type":"f","name":"ExtuderIndictor2.gcode","size":542905,"date":"2018-09-13T20:13:22"},{"type":"f","name":"ExtuderIndictor3.gcode","size":542905,"date":"2018-09-13T20:23:01"},{"type":"f","name":"ExtuderIndictor4.gcode","size":542911,"date":"2018-09-13T20:25:18"},{"type":"f","name":"1ExtuderIndictor.gcode","size":550411,"date":"2018-09-13T20:57:14"},{"type":"f","name":"2ExtuderIndictor.gcode","size":550459,"date":"2018-09-13T21:14:23"},{"type":"f","name":"40mmcube.gcode","size":69589,"date":"2018-09-13T21:20:13"},{"type":"f","name":"11140mmcube.gcode","size":68806,"date":"2018-09-13T21:40:26"},{"type":"f","name":"Abstract_vase.gcode","size":6538633,"date":"2018-09-17T16:29:07"},{"type":"f","name":"Abstract_vase2.gcode","size":6538504,"date":"2018-09-17T16:31:16"},{"type":"f","name":"Abstract_vase3.gcode","size":6538344,"date":"2018-09-17T16:35:05"},{"type":"f","name":"Abstract_vase0Z.gcode","size":6538003,"date":"2018-09-17T16:40:02"},{"type":"f","name":"Abstract_vase1Lay.gcode","size":6536928,"date":"2018-09-17T16:47:12"},{"type":"f","name":"Abstract_vaseasdfads.gcode","size":6538395,"date":"2018-09-17T17:06:01"},{"type":"f","name":"TestGuard3dprint.gcode","size":2235643,"date":"2018-09-19T16:17:03"}],"next":0}
-
And to get started with the code - https://github.com/limited660/Duet-ESP8266-LCD
-
I'm just gonna throw this out here for some ideas. It doesn't look like there is enough IO available on the typical 30 pin ESP8266 board to use the standard 20x4 smart controller or 128x64 full graphic without modification; 9 pins are required just for LCD, Encoder, and Encoder Button - still need 7 more pins for the reset button, SD card, and buzzer.
Options:
ESP8266
- Display and encoder (with button) only - no modifications required to the ESP8266
- Display, encoder, reset button, and buzzer - requires use of shift register for LCD, will cut pins from 6 to 3 - no SD card
ESP32 - Availability looks odd so I may want to stick with an Adafruit Huzzah32 or Sparkfun ESP32 Thing
- Display, encoder, reset button, and SD card - no modifications required
- Everything! - requires use of shift register for LCD
Unfortunately with the 32 as discussed there are several different boards...one on Amazon has 38 pins while all of the ones I seen with a quick glance on Aliexpress have 30. I'm kind of stuck with using a dev board as I don't have the electronics or PCB knowledge to create my own ESP32 breakout.
I would like to stick with the RepRap style displays as they are cheap and the goal of this is to keep the price down. Both displays run around $10-15 for the display, encoder, reset, buzzer, and SD. There are options for i2c displays and encoders but that pushes cost up for minimal gain.
I'm thinking ESP8266 with the shift register and just ignore the SD card as you can just use DWC or the slicer to send the file to the Duet. There will still be the option to select which file to print (provided I can figure out how to do it). There is one more option of using a Teensy and an ESP8266 but that's really pushing it for my skill level.
-
Why SD-CARD? It will work much shittier than the Duet embedded version.
-
@sigxcpu said in ESP8266 Controlled Display Project Log:
Why SD-CARD? It will work much shittier than the Duet embedded version.
The PanelDue has an SD card and these displays already have one, its just a matter of hooking it up. Files would be sent from the SD card over WIFI to the Duet anyway, it would not be for printing from the display.
-
@tjb1 You said you are constrained on number of pins. So adding a SD-CARD because PanelDue has one (not constrained in number of pins) and not using it will eat precious pins count, right?
-
just downloaded your lib to my esp8266, and I think I'm connecting but I'm getting zeros for all values. Do you know what might be my issue? I don't see how the code handles login to the duet, don't see a password value anywhere.
Great job with your library though, this looks very promising for my project. I just want to monitor everything from an arduino, without using hardwired i/o.
Serial Display:
Connecting...
HTTP Code: 401
X Pos: 0.00
Y Pos: 0.00
Z Pos: 0.00
Name:
Firmware:
Current Voltage: 0.00 -
@btmcmahan said in ESP8266 Controlled Display Project Log:
HTTP Code: 401
unauthorized, so odds are its not dealing (correctly) with login - disabling the password on the duet temporarily is a quick test.