Z height display

I wanted a big display to show the z height (depth) of my Maslow, when I’m in the workshop.
Of course it’s machined on the Maslow itswlf :slight_smile:


Marking where the cutouts on the under side is located. Helps me place the wires afterwards.


Add led strip (ws2812)


Solder wires and mount the front frame


Test pattern for the LEDs.

The only thing missing now is some opaque acrylic which should diffuse the light nicely and writing the driver for the arduino. It should be sniffing on the serial communication to the main controller.

12 Likes

How are you passing the z axis values to the LED display?

2 Likes

As an alternative you could script to take the current Z value from the log or from the terminal.
Love that display and have all the stuff to copy it :slight_smile:

2 Likes

I’ve written the driver for sniffing on the comm FROM the controller. Basically I’m jutæst parsing the return coordinate from the MCU. I have it working on my desk just need to add the wires to the Maslow controller and some connector.
Oh yeah and I need the acrylic front.
I have several ideas for the front:

  • A white opaque acrylic covering the whole surface

  • Smaller countersunl cutouts in the same acrylic as above. However I have messed up the siding of the segments so the middle is very close to the others. Might try it though

  • Using the Maslow to mill pockets from the backside so I’m about 0.1 mm from getting through. This way the display Will look like a plain piece of wood when not powered on but the light will shine through when I’m using the machine. This is by far the coolest option but I’m not sure I can pull it off…

5 Likes

Sharing is caring :slight_smile:

3 Likes

Instead of trying to make a pocket could you just cut all the way through and then cover the whole thing in a veneer? It would have a similar effect. I’ve seen a wood alarm clock created this way, but alarm clock is obviously much smaller.

Very interesting! Once you have the thing up and going I am willing to see the details of how you got the height info of z-axis out from the arduino and/or the shield.

I was thinking the same thing - but wouldn’t it be a cool demonstration of what the maslow can do if I could mill it :slight_smile:

@Gero and @arne2050 I think you’re interested in this:

I finally got it hooked up and working. Took way longer than I would like to admit.

I already have a bunch of ideas for refinements:

  • a potentiometer for intensity adjustments
  • change the color according to the actual depth
  • add a decimal point and another digit for more information (it’s not rounding the number right now so if the depth is 1.99 it will still show 1)
  • add comments in the code and make it ‘friendly’

The design is available through onshape.com - direct link here
and the code is here - no comments not very clean and I think I could have done it smarter. On the other hand it’s very responsive and fairly easy to extend to the other axes - so if you really want to see where you’re machine is right now - from across your workshop this is it:

Code is here...
#include <Adafruit_NeoPixel.h>

#define PIN 6
#define LEDSPERSEGMENT 4

Adafruit_NeoPixel strip = Adafruit_NeoPixel(56, PIN, NEO_GRB + NEO_KHZ800);

uint32_t color = strip.Color(40, 0, 0);
int number = 0; //the number to show on the display
int oldNumber=1;

// IMPORTANT: To reduce NeoPixel burnout risk, add 1000 uF capacitor across
// pixel power leads, add 300 - 500 Ohm resistor on first pixel’s data input
// and minimize distance between Arduino and first pixel. Avoid connecting
// on a live circuit…if you must, connect GND first.

void setup()
{
strip.begin();
strip.show(); // Initialize all pixels to ‘off’
Serial.begin(57600);
Serial.println(“Starting…”);
}

unsigned char offset1[] = {3,4,6,0,1,2,5}; //segment1 offset
unsigned char offset2[] = {2,3,5,6,0,1,4}; //segment2 offset
unsigned char segments1[][7] = {{1,1,1,1,1,1,0},{0,1,1,0,0,0,0},{1,1,0,1,1,0,1},{1,1,1,1,0,0,1},{0,1,1,0,0,1,1},{1,0,1,1,0,1,1},{1,0,1,1,1,1,1},{1,1,1,0,0,0,0},{1,1,1,1,1,1,1},{1,1,1,0,0,1,1}};
unsigned char segments2[][7] = {{1,1,1,1,1,1,0},{0,1,1,0,0,0,0},{1,1,0,1,1,0,1},{1,1,1,1,0,0,1},{0,1,1,0,0,1,1},{1,0,1,1,0,1,1},{1,0,1,1,1,1,1},{1,1,1,0,0,0,0},{1,1,1,1,1,1,1},{1,1,1,0,0,1,1}};

void loop()
{
while(Serial.available())
{
String text = Serial.readStringUntil(‘M’);
if(text.length()>32)
{
char index = text.indexOf(’,’);
char index2 = text.indexOf(’,’,index+1);
text = text.substring(index+1,index2);
number = abs(text.toInt());
if(oldNumber!=number)
{
oldNumber=number;
showNumber();
}
}
}
}

void showNumber()
{
for(int i=0;i<LEDSPERSEGMENT72;i++)
strip.setPixelColor(i,strip.Color(0,0,0));
strip.show();

if(number>9)
{
for(int i=0;i<7;i++) //for all segments in a number
{
if(segments1[number/10][i]==1) //if the segment should light up
{
for(int j=0;j<LEDSPERSEGMENT;j++)
strip.setPixelColor((offset1[i]*LEDSPERSEGMENT)+j, color);
}
}
}

for(int i=0;i<7;i++) //for all segments in a number
{
if(segments2[number%10][i]==1) //if the segment should light up
{
for(int j=0;j<LEDSPERSEGMENT;j++)
strip.setPixelColor((offset2[i]*LEDSPERSEGMENT)+j+28, color);
}
}
strip.show();
}

IMG_20180803_225036

edit 1: added onshape linke
edit 2: okay, I can see the code shoud go on github since the forum really don’t like my formatting. Will update with link when it’s available. until then it will stay here.

7 Likes

Oh wow, thank you for sharing this!
I hereby nominate it for the POW.

Edit: Would you consider putting it in the Community Garden?

3 Likes

Wow, thanks man :smiley:

Yes, sure - I haven’t done anything like that before but sure :smiley:
If you build this, I would be happy to know about not-so-obvious bits if you encounter them!

2 Likes

just a little bit more info on how I did this.

I’m looking at the return data from the MCU.
What I’m looking for is data in this format:
<Idle,MPos:0.00,0.00,1.41,WPos:0.000,0.000,0.000>
When I’ve found a line like that, I’m searching for the commas and more specifically, the location of them. this way I can see that the Z information is between the commas at postion 19 and 24.
lastly i convert the characters into a integer using the ‘atoi’ function.
More on that in the code and in the garden :slight_smile:

2 Likes

I might consider this to show my partner the balance on my account :rofl:

1 Like

Don’t make too many digits then :smile:

1 Like

For the poor :slight_smile:
A second terminal with (linux): tail -f log.txt | grep -i ‘Z[^ ]*’

1 Like

Extra credit :grin: for:

  • watch the stream for G20/G21 to indicate in./mm.
  • sign
  • decimal point
1 Like

I will add the decimal point and the sign
above 9mm I don’t have the space for sign and decimal though (not right now at least!)

I’m listening on the return line from GRBL so I don’t see any Gcodes (or do I?) However, the values should still be in the same field in the return string so adjusting how it’s viewed should be fairly simple :slight_smile:

1 Like

Each gcode line is echoed in the stream as well, so ‘G20’ will be in the stream. Look in log.txt to see the contents of the stream.

But I’m looking at the response from the controller, not the data stream going to it. I’ll have a closer look and see if I can find the G20/G21 commands there

1 Like

Okay, time for version 2 :slight_smile:
I was fuzzing about the display not being able to show a sign… but hey, it’s RGB right??
So why not have positive values in green and negative in red?
I just did that. And added a decimal point to the show.

15 Likes