Plotclock using Line-us + Node RED


#1

Hey Folks.

Just thought I’d share a little project I’ve been playing with.

I recently picked up a line-us on ebay, and being a bit of a hardware hacker the first thing I did was play around with the machines various API’s. @rob was kind enough to grant me access to the BETA firmeware which comes with websocket support and I just found this so much fun.

For my project then I used the websockets API and connected it with Node RED and implemented a plotclock. For those who may not know, a plotclock is some kind of robot that draws the time on a whiteboard surface and then erases and redraws the time when it changes.

I’ve uploaded a couple of videos on instagram which you can find here and the node red flow for the project can be found here (it depends on the simple message queue and moment contrib nodes so you’ll need to make sure you have the installed too) and you’ll need to 3D print a little eraser which you can find my STL file here.

Ultimately the flow connects to the line-us machine then runs through a routine where it fetches the current time, then uses some predefined GCODE templates to generate the output GCODE required (shifting them along the print area). The GCODE is then pushed into a queue and is fed to line-us one by one. As the flow receives an OK message, it releases the next GCODE command until the current routine is complete. Once it is complete, it uses the HOME position ok response to trigger then next iteration. This time however the routine will wait in a loop until the time actually changes and then in the GCODE building node it also injects some initial GCODE to grab the eraser and clear the print area before plotting the the time again.

Overall it was a fun little project and am really happy I picked one of these little machines up.


#2

AWESOME - never used node red so its time to get there :slight_smile:

do I need to adapt part of the code to make it work with my unit?

Congrats to buying Line-US


#3

The only things you should need to change are potentialy the time zone in the “moments” node and maybe the connection address (I ended up using the line-us ip address as it was more reliable than the line-us.local hostname). Other than that, there reset should stay the same.


#4

Thanks for guiding - got node-red up and running and when importing your script and deploying some movements are occuring on the Line-us; is there a way to see / report whats happening during the script? I try to add message and see debugs but so far no luck


#5

The line-us does make a “wave” movement when a connection is made / lost so that is to be expected, but otherwise it should just move based on the GCODE commands.

To debug you can connect any node to a the debug node to output what it’s payload is to the debug console on the right hand side, but for errors nested deep in a node you’d probably need to check the node-red error log.

Hope that helps

Matt


#6

I’ve run it here and it seems to work fine. Here’s what I did:

  1. Download the flow from Matt’s GitHub
  2. Install the two packages:
    npm install node-red-contrib-simple-message-queue
    npm install node-red-contrib-moment
  3. In the node red gui, paste in the flow from the json file in 1. using import/clipboard
  4. Double click on the flow tab and enable.

As Matt said, if your Line-us is waving that means you’re connecting OK - as he mentioned in his original post, using the mDNS name line-us.local can sometimes fail but if you’re not seeing the wave then you could try using the IP address of your Line-us.


#7

That’s awesome that you go it to work as well :smile:

Thanks for building such a fun little machine.


#8

Not sure what was keeping it running yesterday; Today is another day :grinning:
Thanks for getting node-red on my radar.

One could run node-red on Raspberry and get a text message sent via a webbrowser to the RPi and line-us will draw that message - right?


#9

No problem and you can indeed. I have a Raspberry Pi with node-red running as a mini server that controls a few things. It works really well.

I’d quite like to figure out how to send a picture then auto trace it and print it out. No idea how to do that at the moment though :grin: