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

    Serials Communication with Arduino Uno?

    Scheduled Pinned Locked Moved Unsolved
    General Discussion
    8
    36
    2.8k
    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.
    • Sindariusundefined
      Sindarius @Sindarius
      last edited by

      I found an old SD card which had the config

      ;Duet Mini5+
      M575 P2 B57600 S0

      1 Reply Last reply Reply Quote 0
      • MintyTreborundefined
        MintyTrebor @Adam - V3D
        last edited by

        @adam-v3d If this helps as a backup/alternative ---

        Because you are already planning to capture the data on a laptop, you can log data easily with node-red & nodeDSF:

        For example - The screen shot below show a csv which logged T0 temp with a time stamp (millisecond) as it cooled down..

        9ab5fcdf-165d-4e08-8e4f-99ada01812e5-image.png

        It took less than 5 mins to put together and gives you access to nearly the entire object model in almost real-time over the network (it uses the same connection methods as DWC).

        NodeDSF - Native Node-Red integration with Duet boards.
        BtnCmd - Customise DWC with user defined buttons/layouts/panels (DWC Plugin)
        ReleaseMgr - Duet update info inside DWC.
        Repo

        Adam - V3Dundefined 2 Replies Last reply Reply Quote 0
        • Sindariusundefined
          Sindarius
          last edited by

          Here's a short video that shows the project that I did. https://www.youtube.com/watch?v=WQDmI404N5k

          1 Reply Last reply Reply Quote 1
          • Adam - V3Dundefined
            Adam - V3D @Sindarius
            last edited by

            @sindarius I think I kind of understood most of the code, only little bits of syntax I didn't understand. I turn on debugging and the end result was that it either paused completely after 500ms (first time it polled the duet) or ran mostly correctly but hotend temps and fan always showed the original values in the library of 10, 285 etc.

            I guess this means there was no data coming from the Duet. Maybe wrong port number. I used M575 P1 B57600 S0 and connector to the RX and TX on the Panel due 4 pin connector next to the 4 pin probe connector.

            1 Reply Last reply Reply Quote 0
            • Adam - V3Dundefined
              Adam - V3D @MintyTrebor
              last edited by

              @mintytrebor This is cool, I guess its easy when you know how. I've never used this before though and not sure how I would sync it up with the other data from the arduino.

              1 Reply Last reply Reply Quote 0
              • Adam - V3Dundefined
                Adam - V3D @Sindarius
                last edited by

                @sindarius Oh i did get the thing with pins 8 and 9 after realising what the library was for and that the designated TX and RX pins are basically the same serial i'm using to connect to the laptop.
                For connection, do you connect duet TX to pin 8, and duet RX to pin 9?

                Sindariusundefined 1 Reply Last reply Reply Quote 0
                • Adam - V3Dundefined
                  Adam - V3D @MintyTrebor
                  last edited by

                  @mintytrebor I've just installed and had a little look at this. I quite like it and might be more my speed but don't understand it really yet. It looks like it'll be capable of polling the arduino and duet at the same time and just merging them into a single file on the pc which could be useful. Maybe also a powerful option for when i'm adding more features later down the line.

                  Are you able to share details on what you showed here?

                  MintyTreborundefined 2 Replies Last reply Reply Quote 0
                  • Sindariusundefined
                    Sindarius @Adam - V3D
                    last edited by Sindarius

                    @adam-v3d you mentioned you are using a duet 2 wifi but I didn’t see what firmware version you are running on the duet

                    1 Reply Last reply Reply Quote 0
                    • MintyTreborundefined
                      MintyTrebor @Adam - V3D
                      last edited by MintyTrebor

                      @adam-v3d Sure.

                      There is an attempt at a wiki for the nodes used to connect to the duet here :
                      https://github.com/MintyTrebor/NodeDSF/wiki/About

                      I also have a nodeDSF channel over on TeamGloomy's discord
                      https://discord.gg/bXcYqGvt

                      The quick POC I threw together earlier, just pulls the T0 temp from the Duet object model ~5 times a second, adds a time stamp, and writes a line to a csv file. That's it. There is an import/export function in nodered, so I can share the POC with you if its useful.

                      I have not used nodered to talk to arduino, there is a nodered faq that covers it here:
                      https://nodered.org/docs/faq/interacting-with-arduino. But if all you need is serial connectivity, then something like this (https://flows.nodered.org/node/node-red-node-serialport) will probably work.

                      .

                      NodeDSF - Native Node-Red integration with Duet boards.
                      BtnCmd - Customise DWC with user defined buttons/layouts/panels (DWC Plugin)
                      ReleaseMgr - Duet update info inside DWC.
                      Repo

                      1 Reply Last reply Reply Quote 0
                      • dc42undefined
                        dc42 administrators @Adam - V3D
                        last edited by

                        @adam-v3d you might like to take a look at the CN Pendant project at https://github.com/Duet3D/CNC-Pendant-Firmware. This communicates to the Duet through the serial port.

                        If you will he using the USB interface to the Arduino as well, then I suggest you use an Arduino Leonardo, Arduino Pro Micro, or Arduino Mega. All of these give you a hardware serial port that is separate from the USB port. Also, the Leonardo and the Pro Micro accept 3.3V input signals, so although you need a simple resistive divider to reduce the Tx output of the Arduino from 5V to 3.3V, you don't need to level shift the output from the Duet up to 5V - although I suggest you use a 1K series resistor.

                        Duet WiFi hardware designer and firmware engineer
                        Please do not ask me for Duet support via PM or email, use the forum
                        http://www.escher3d.com, https://miscsolutions.wordpress.com

                        1 Reply Last reply Reply Quote 0
                        • MintyTreborundefined
                          MintyTrebor @Adam - V3D
                          last edited by MintyTrebor

                          @adam-v3d
                          Attached is a example flow you can import which creates 2 connections to 2 different control boards, 1 via serial com port (over usb), the second over the network using the NodeDSF nodes.

                          For the example:
                          Serial Connection Board 1: Send the M409 command via serial to get the chamber temp from the object model, and request a new update every 200ms, writing the values to a csv file.
                          Network Connection Board 2: Connect to board, and get updated bed temp every 200ms and write result to different csv file.

                          You can then combine this data in whatever tool is required (excel etc).

                          If you want to push it further you can map the data to a chart in real-time in node-red using dashboard nodes eg
                          9fdcb9c4-0989-49f5-b8e9-5010d38e82b6-image.png

                          Flow in node-red

                          6d289e47-2c4d-491b-83c7-e668b76c34c0-image.png
                          serialcsvtest.json

                          NodeDSF - Native Node-Red integration with Duet boards.
                          BtnCmd - Customise DWC with user defined buttons/layouts/panels (DWC Plugin)
                          ReleaseMgr - Duet update info inside DWC.
                          Repo

                          Adam - V3Dundefined 1 Reply Last reply Reply Quote 1
                          • Adam - V3Dundefined
                            Adam - V3D @MintyTrebor
                            last edited by

                            @mintytrebor thankyou!

                            Adam - V3Dundefined 1 Reply Last reply Reply Quote 0
                            • Adam - V3Dundefined
                              Adam - V3D @Adam - V3D
                              last edited by

                              @adam-v3d Gave the node red thing a pretty good shot today, spent some time learning how it works and managed to get it working and sending back data. In the current state I have it, on a 200ms request, it take anywhere from 227ms to over 1600ms to get a response when idle and also seems to be crashing the duet quite often too which would make the test void so going to abandon that idea. Currently I can get reading every 25.5ms +-0.5ms with the arduino and would like to keep that kind of rate and precision where possible.

                              I got some new level shifters that seem to work a bit better so i'm going to give the direct serial connection another go and also try with the arduino mega if It doesn't go well with the uno.

                              MintyTreborundefined 1 Reply Last reply Reply Quote 0
                              • MintyTreborundefined
                                MintyTrebor @Adam - V3D
                                last edited by

                                @adam-v3d said in Serials Communication with Arduino Uno?:

                                on a 200ms request, it take anywhere from 227ms to over 1600ms to get a response when idle and also seems to be crashing the duet quite often too

                                Out of interest is that using the serial connection node?

                                NodeDSF - Native Node-Red integration with Duet boards.
                                BtnCmd - Customise DWC with user defined buttons/layouts/panels (DWC Plugin)
                                ReleaseMgr - Duet update info inside DWC.
                                Repo

                                Adam - V3Dundefined 1 Reply Last reply Reply Quote 0
                                • Adam - V3Dundefined
                                  Adam - V3D @MintyTrebor
                                  last edited by

                                  @mintytrebor no sorry that was wifi, i didn't expect wifi to be good.

                                  Adam - V3Dundefined 1 Reply Last reply Reply Quote 0
                                  • Adam - V3Dundefined
                                    Adam - V3D @Adam - V3D
                                    last edited by

                                    @adam-v3d the node was the DSF monitor node.

                                    MintyTreborundefined 1 Reply Last reply Reply Quote 0
                                    • MintyTreborundefined
                                      MintyTrebor @Adam - V3D
                                      last edited by

                                      @adam-v3d Would you mind sharing the flow please. If you have found a new bug with the Monitor node I would like to try and track it down. I have never seen it cause a board crash, so I need to investigate.

                                      Thanks

                                      NodeDSF - Native Node-Red integration with Duet boards.
                                      BtnCmd - Customise DWC with user defined buttons/layouts/panels (DWC Plugin)
                                      ReleaseMgr - Duet update info inside DWC.
                                      Repo

                                      Adam - V3Dundefined 1 Reply Last reply Reply Quote 0
                                      • Adam - V3Dundefined
                                        Adam - V3D @MintyTrebor
                                        last edited by

                                        @mintytrebor Sure. flows.json

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