Duet3D Logo Duet3D
    • Tags
    • Documentation
    • Order
    • Register
    • Login

    New M-code to send a network request

    Scheduled Pinned Locked Moved
    Firmware wishlist
    15
    51
    6.7k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Danalundefined
      Danal
      last edited by Danal

      So, having said all of that, the origin of this thread was "M code to send a network request".

      An ESP8266 could be very good at sending the network request... Tons of different libraries for every protocol under the sun, and the ESP can be a WiFi client, Access-Point, or both at the same time. Very capable little IOT network device.

      I know it bothers people to have to add something to the already very capable Duet... but... come on, ESPs are easy to get for $4 to $6 US, even in low quantities, and can be had for even less if you are willing to order in quantity and wait for a direct Asian shipment. Anyway...

      A Duet to ESP connection would work over TTL serial, very easily.

      A Duet to ESP I2C might be made to work, if someone can find a library or whatever that makes the ESP work as an I2C slave. At this moment, I don't know of any that are proven to work.

      Delta / Kossel printer fanatic

      Nightreaverundefined 1 Reply Last reply Reply Quote 0
      • fmaundefined
        fma
        last edited by

        There are some examples of I²C slave with the ESP8266 Arduino package, so I think it can work.

        Frédéric

        1 Reply Last reply Reply Quote 0
        • A Former User?
          A Former User
          last edited by

          Seems ESP8266 as a slave is limited to 14khz with the current software implementation and it lacks proper hardware support. People report success between two ESP8266 but not with a non ESP master. Hoping to verify during the week

          1 Reply Last reply Reply Quote 0
          • Nightreaverundefined
            Nightreaver @Danal
            last edited by

            @dc42 Yes, I didnt mean infos about I²C in general, but related to the duet. But at one point everything will be discussed in the forums anyways.

            @danal Yes ESP are cheap to get, i got 5 WemosD1 for 12$ ? they have the cheaper CH340 chipset, but that still works well after you installed the driver.

            So you can get the high quality wemos here:
            https://www.aliexpress.com/item/WeMos-D1-mini-PRO-analog-WiFi-D1-mini-PRO-integration-of-ESP8266-32Mb-flash-and-USB/32806566263.html

            cheaper bulk wemos:
            https://www.aliexpress.com/item/5pcs-D1-mini-Mini-NodeMcu-4M-bytes-Lua-WIFI-Internet-of-Things-development-board-based-ESP8266/32832024575.html

            or the ESP32 wroom:
            https://www.aliexpress.com/item/ESP-32S-ESP-WROOM-32-ESP32-ESP-32-Bluetooth-and-WIFI-Dual-Core-CPU-with-Low/32864722159.html

            secondly:
            afer adding the resisors (1k each) i was able to get at least an exception when i have scl/sda wrong way, so i think in general it "works"...

            So even tho it doesnt work, i also thought about grabbing serial from the duet and build something around that.
            But I dont really wanna sacrifice the usb for that. I have some USB-TTL laying around as well... just didnt check them for wiring on the duet/esp yet.

            @bearer that is limited to ESP8266? and what about that ESP32? looks like a bigger package...

            @fma I will check to figure something about the slave/master thing. General communication wasn't working yesterday... so i gave up at one point

            A Former User? 1 Reply Last reply Reply Quote 0
            • A Former User?
              A Former User @Nightreaver
              last edited by A Former User

              @nightreaver said in New M-code to send a network request:

              @bearer that is limited to ESP8266? and what about that ESP32? looks like a bigger package...

              AFAIK ESP32 has hardware I2C support.

              There may be some WIP for 100khz I2C for ESP8266, but haven't seen the code as a PR for the ESP repo

              1 Reply Last reply Reply Quote 0
              • cookieundefined
                cookie
                last edited by

                This is a very interesting topic. It would open a lot of possibilities for production printing. For now, I got to learn and find workarounds until Duet 3.

                Thanks a lot !

                1 Reply Last reply Reply Quote 0
                • JoergS5undefined
                  JoergS5
                  last edited by JoergS5

                  ESP32 documentation of ESP-IDF says: "There are two I2C controllers on board of the ESP32, each of which can be set to master mode or slave mode.", so if ESP8266 is restricted, I would recommend ESP32.
                  The documentation is here: https://docs.espressif.com/projects/esp-idf/en/latest/api-reference/peripherals/i2c.html

                  1 Reply Last reply Reply Quote 0
                  • fmaundefined
                    fma
                    last edited by

                    This module could be a good candidate:

                    https://www.crowdsupply.com/unexpected-maker/tinypico

                    Frédéric

                    1 Reply Last reply Reply Quote 0
                    • JoergS5undefined
                      JoergS5
                      last edited by

                      I will build an absolute optical encoder to get the actuator positions of the scara printer, so I use ESP-CAM to have the camera.

                      1 Reply Last reply Reply Quote 1
                      • Nightreaverundefined
                        Nightreaver
                        last edited by Nightreaver

                        I think one issue is, that these device supporting that mode on hardware side, tho the implemenation is missing.
                        Last time i checked there was no slave implementation on Arduino side, tho micropython seem to have it.
                        I just didnt start setting up micropython yet....

                        JoergS5undefined 1 Reply Last reply Reply Quote 0
                        • JoergS5undefined
                          JoergS5 @Nightreaver
                          last edited by JoergS5

                          @nightreaver I can give you my code when it's finished. But it will be C for ESP-IDF, not Arduino .ino.

                          1 Reply Last reply Reply Quote 0
                          • tomwor2undefined
                            tomwor2
                            last edited by

                            Is there any new information on this topic? I am just getting my new printer fired up and was hoping to be able to send a message to node-red running on a Pi. Node-red manages most protocolls mentioned in this thread including MQTT, HTTP UDP and TCP, so for me it does not really matter which protocol that is used. It would be great to be able to for example shut down the machine when it's done using a smart plug och get a message when it runs out of filament etc.

                            DIY-O-Sphereundefined 1 Reply Last reply Reply Quote 0
                            • DIY-O-Sphereundefined
                              DIY-O-Sphere @tomwor2
                              last edited by DIY-O-Sphere

                              @tomwor2
                              It works the opposite way...
                              If you are familiar with Note Red you can pull the status information from the Duet, run some code in Node Red and send any command back to the Duet via g-code....
                              https://forum.duet3d.com/topic/18520/node-red-mobile-sized-status-dashboard-for-duet

                              But for an easy shut down after print is finised, that it's not required.
                              You can use the PS_ON pin to switch the printer of.
                              Or a more current solution....
                              https://forum.duet3d.com/topic/19161/smart-remote-power-control

                              (UTC+1)

                              tomwor2undefined 1 Reply Last reply Reply Quote 0
                              • tomwor2undefined
                                tomwor2 @DIY-O-Sphere
                                last edited by tomwor2

                                @DIY-O-Sphere said in New M-code to send a network request:

                                that it's not required.
                                You can use the PS_ON pin to switch the printer of.
                                Or a more current solution....

                                Thanks for the input. I was hoping to avoid having to turn on a node-red flow when I am printing and not have to buy more hardware but your input made me think around it a couple of more turns and I think I have come up with a workable solution.

                                I do not have a separate PSU for 5v as I plan to run the board only when the printer is turned on but I do have a smart home controller.

                                I'll simply activate the node-red flow every time the smart plug for the printer is turned on and turn it off after having ensured the printer is turned off. The smart plug was anyhow needed to shut the printer down when ready and I can also measure the power I consume for printing 😀

                                1 Reply Last reply Reply Quote 0
                                • First post
                                  Last post
                                Unless otherwise noted, all forum content is licensed under CC-BY-SA