FluidNC Lunch box, Assembly

Image for FluidNC Lunch box, Assembly

This article is all about building your lunch box FluidNC pendant. You are going to need your printed parts, soldering iron, screw driver(s) and your sourced parts according to the BOM.
The estimated time to first signs of live, is going to be roughly half a day.

General Notes, "before you start":
This manual assumes that you sourced all "primary" BOM parts and no alternatives/substitutes. If you are not sure if your substitute part is going to work, please try the primary part first.

The manual is structured in distinct sections for the components. Like for the display, the push buttons or rotary encoder. Every section features a table, containing the specific Arduino pins, it needs to be connected to. An additional sketch with scematics and a describing text, give some more information. 

The following sections are only bite sized and listed in such a way, that they can be done, one by one. If you you want to, you can swap order in most cases.

A table for general overview, containing all used Arduino pins, is given in the first section. Some pins, usually used with many Arduino project, are intentionally left unused. This is for you to easily add your own parts, functions and/or for future extensions.

General Notes, "Soldering":
You can solder all parts directly to the Arduino. Id highly advise against it though. Using pin headers and PCB might take some additional time during assembly, but it is going to make live much easier during trouble shooting and parts swapping. Pin header also just look neat. 

This manual assumes that you are using 20x80mm and 40x60mm prototyping PCB board. They are needed in order to mount all pull down resistors, provide space for a common 5V/GND rail and also to take pin headers.

Assembly:

Section 1
Preparing PCB board

Note: Although this first section and its table looks very long, it is basically just about soldering pin headers to the PCB boards. The following Sections feature smaler bites of this table, only showing pins of the part currently worked on.

Let’s go!

Place all pin header, pull down resistor (10k) and LED resistor (220R) on the 40x60mm PCB board. Arange them in any layout you like. Make sure you have enough space for a +5V and GND rail. Refer to the following table for Arduino Pins to use.

No

Pin Arduino

Pin Part

Part

Note

1

2

1

Rotary Encoder, A

2

3

2

Rotary Encoder, B

3

4

3

Rotary Encoder, PushButton

4

+5V

4

Rotary Encoder, +5V

5

GND

5

Rotary Encoder, GND

6

10

1

Display, RS

7

11

2

Display, R/W

8

13

3

Display, E

9

+5V

4

Display, VCC

10

GND

5

Display, GND

11

18

1

Level Shifter, IN/OUT

18 (Arduino TX) goes to Pin25 (ESP32 RX)

12

19

2

Level Shifter, IN/OUT

19 (Arduino RX) goes to Pin27 (ESP32 TX)

13

+5V

3

Level Shifter, +5V

14

GND

4

Level Shifter, GND

15

+3.3V

5

Level Shifter, +3.3V

Supplied by your ESP32 / FluidNC controller board

16

22

1

A LED

Connect via 220R resistor

17

23

2

A Button

Connect with 10k pulldown resistor to GND

18

+5V 

3

A Button, +5V

19

GND

4

A Button, GND

20

24

1

B LED

Connect via 220R resistor

21

25

2

B Button

Connect with 10k pulldown resistor to GND

22

+5V 

3

B Button, +5V

23

GND

4

B Button, GND

24

26

1

C LED

Connect via 220R resistor

25

27

2

C Button

Connect with 10k pulldown resistor to GND

26

+5V 

3

C Button, +5V

27

GND

4

C Button, GND

28

28

1

A Distance LED

Connect via 220R resistor

29

29

2

A Distance Button

Connect with 10k pulldown resistor to GND

30

+5V 

3

A Distance Button, +5V

31

GND

4

A Distance Button, GND

32

30

1

B Distance LED

Connect via 220R resistor

33

31

2

B Distance Button

Connect with 10k pulldown resistor to GND

34

+5V 

3

B Distance Button, +5V

35

GND

4

B Distance Button, GND

36

32

1

C Distance LED

Connect via 220R resistor

37

33

2

C Distance Button

Connect with 10k pulldown resistor to GND

38

+5V 

3

C Distance Button, +5V

39

GND

4

C Distance Button, GND

40

34

1

D Distance LED

Connect via 220R resistor

41

35

2

D Distance Button

Connect with 10k pulldown resistor to GND

42

+5V 

3

D Distance Button, +5V

43

GND

4

D Distance Button, GND

44

36

1

Extra A LED

Connect via 220R resistor

45

37

2

Extra A Button

Connect with 10k pulldown resistor to GND

46

+5V 

3

Extra A Button, +5V

47

GND

4

Extra A Button, GND

48

38

1

Rotary Selector, Tool/Spindle

Connect with 10k pulldown resistor to GND

49

39

2

Rotary Selector, X Axis

Connect with 10k pulldown resistor to GND

50

40

3

Rotary Selector, Y Axis

Connect with 10k pulldown resistor to GND

51

41

4

Rotary Selector, Z Axis

Connect with 10k pulldown resistor to GND

52

42

5

Rotary Selector, A Axis

Connect with 10k pulldown resistor to GND

53

43

6

Rotary Selector, B Axis

Connect with 10k pulldown resistor to GND

54

+5V 

7

Rotary Selector, +5V

55

GND

8

Rotary Selector, GND

56

44

1

Extra B LED

Connect via 220R resistor

57

45

2

Extra B Button

Connect with 10k pulldown resistor to GND

58

+5V 

3

Extra B Button, +5V

59

GND

4

Extra B Button, GND

After some initial soldering, you should have something like this:

Note: You might wonder why most of shown pin header feature 5 pins, instead 4, otherwise needed for connecting any push button. This is because I had an initial design in mind, with push button and LED separated. This is unnecessary though. 

Section 2
Preparing push buttons

For connecting any push button, see following scematic. PushButton A is shown as example. All other, are connected the same. Refere to main table of Arduino Pins, for specific pins to use with any push button

After Soldering is done, attach jack screws x2 (BOM Pos.19) to PCB-Arduino_Base. Attach the Arduino to it and also secure the PCB in place with M2x10 x4 (BOM Pos.18). See above picture for reference.

Section 3
Connecting Display


The 10k potentiometer (BOM Pos.8) is needed for dialing in the displays contrast. This is only needed once, so any smal potentiometer is going to be suitable here. Dont forget to add a 220R resistor (BOM Pos.6) on display pin 19. This is needed in order to limit the current on the backlight LEDs

No

Display Pin No

Display Pin

Note

Arduino Pin

1

1

GND

GND

2

2

VCC

+5V

3

3

V0

10k Potentiometer (between +5V and GND) needed for dialing in contrast

4

4

RS

10

5

5

R/W

11

6

6

E

13

7

15

PSB

GND

8

19

BLA 

+5V LED Display. Dont forget the 220R Resistor

9

20

BLK

GND LED Display

Your wiring should look like this now. Please just ignore the solder joints quality shown in picture above...

Section 4
Connecting Rotary Switch  (Channel/Axis selector)

In order to safe some space on the PCB, the pulldown resistor can be soldered directly on the switches backside. 

No

Pin Switch

Pin Arduino

Function

Note

1

38

1

Rotary Selector, Tool/Spindle

Connect with 10k pulldown resistor to GND

2

39

2

Rotary Selector, X Axis

Connect with 10k pulldown resistor to GND

3

40

3

Rotary Selector, Y Axis

Connect with 10k pulldown resistor to GND

4

41

4

Rotary Selector, Z Axis

Connect with 10k pulldown resistor to GND

5

42

5

Rotary Selector, A Axis

Connect with 10k pulldown resistor to GND

6

43

6

Rotary Selector, B Axis

Connect with 10k pulldown resistor to GND

7

+5V 

7

Rotary Selector, +5V

8

GND

8

Rotary Selector, GND

Section 5
Connecting Rotary Encoder

Just solder all wires directly to the KY-040 PCB. If you use a "regular" Rotary encoder, dont forget to add pulldown resistors.

No

Pin Encoder

Pin Arduino

1

A

2

2

B

3

3

PushButton

4

4

+5V

+5V

5

GND

GND

Section 6
Connecting Level Shifter and preparing main connection cable

The Level shifter needs 3.3V, 5V and GND in order to work. Although the Arduino provides a 3.3V rail, the lunch box is sourced by the ESP32 3.3V supply. The scematic does show the level shifter "inserted" within the main cable, running from the lunch box to the CNC. A "Spare" wire also is drawn but not used.

You can connect the lunch box to any RX/TX cabable pins on your CNC-ESP32, if pins 25 and 27 are not available. See ESP32 documentation for detail. I chose pins 25+27 in the first place, because they are left spare on the 6x CNC Controller for FluidNC by B.Dring. This makes them just easy to connect to.

Place all parts on the 20x80mm PCB and solder all in place. Bolt the PCB onto the PCB-LevelShifter part. Use Bolts M2x5 (Pos.17 BOM)

Connect the shield of cable (Pos.22 BOM) ONLY ON ONE SIDE TO GND. It does not really matter which side gets connected, but as soon as you connect both sides, the shielding might not work as intended anymore.

No

Pin Pendant

Pin Level Shifter

Pin FluidNC Board

1

+5V

+5V

+5V

2

-

+3.3V

+3.3V

3

18 (Tx)

Sign. IN/OUT

25 (GPIO)

4

19 (Rx)

Sign. IN/OUT

27 (GPIO)

5

GND

GND

GND

6

Spare

-

Spare

Section 7
Mount Display and all input switches

Place Rotary Selector and your display assembly on the TopCover part. Bolt the assembly in place with M3x8 (Pos.14 BOM). 

Insert Rotary Knob in TopCover and Put on the Knob_Big_Guard before securing the rotary knob in place.

Insert pushbuttons A, B and C. Put Button_GuardTripple in place and bolt it down with M3x8 (Pos14 BOM)

Connect all mounted parts to the PCB.

Insert pushbuttons AD, BD, CD and DD in DesignPlate and put all in TopCover. Connect the pushbuttons to the PCB.

Insert pushbuttons ExtraA and ExtraB in TopCover and put ButtonGuard in place. Use M3x8 (Pos.14 BOM)

Bolt the GlareShield to TopCover with M3x8 (Pos.14 BOM) and attach 3D printed RotaryKnob + ChannelSelector to their switches. You can secure them in place with M3x8 (Pos.14 BOM)

Section 8
Function Test

All functional parts of the lunch box are in place now. In order to check, if everything is wired correctly and all parts are working as intended, a quick test is advised.

Connect the arduino to your PC via USB and start the Arduino IDE. Download sketch "lunch_box_pendant_HardwareTest" from the lunch box model page. Install this sketch on the Arduino.

The test works as follows:

The ChannelSelector (green) is going to set "Channel" to value 6 in its top most position. In its down most position, it should show Channel = 1. A sweep from down most to top most position should show values 1, 2, 3, 4, 5, and 6.

Ever pushbutton has a number asigned to it (red). As soon as a button is pressed, it should show its number on the display and the internal LED has to turn on.

"RtryCntr" has to count up for every activation of the rotary encoder in the positive direction ("+", Clock Wise). It counts down for every activation in the negative direction ("-", Counter Clock Wise).

"RtryPsh" has to count up for every activation of the rotary knobs pushbutton.

If the position of your pushbuttons is not according to the above picture, rewire them in order to post in the shown order.

If everything works to a satisfying degree, download "lunch_box_pendant_V0_95_Stable" (or most recent) from the lunch box model page and install it on the Arduino.

Section 9
Final assembly.

Bolt Utility_ExtensionPort_Cover and USB_Cover to the Frame. Use M3x5 (Pos.13 BOM)

Attach "PCB-LevelShifter" to the Frame. M3x8 (Pos.14 BOM). Also feed the main Cable through the Cable Gland (Pos.20 BOM). Rememer, the cable shielding must only be connected on ONE side of the cable.

Put the TopCover assembly on the Frame

Connect the TopCover assembly with M3x8 (Pos.14 BOM) to the Frame. Only use Bolt holes as shown in Picture down below. The other ones have to stay blank for now.
Note: Bolts in the corners are optiona in general

Attach Handle_Short and Handle_Long to the TopCover and Frame. Use M3x10 (Pos.15 BOM).

Put BottomCover in place and attach it to the Frame. Attach GripLong and GripShort to the Bottom Cover. Use M3x8 (Pos.14 BOM)in both cases. Only use Bolt holes as shown in Picture down below. The other ones have to stay blank for now.

Attach all Bumper Parts to BottomCover with M3x8 (Pos.14 BOM. Use M3x10 for attaching Bumpers to the Frame.

Attach StrapHook to the Frame. Use M3x10 (Pos.15 BOM)

Section 10
Final finish


Attach the most important part now. The Batch. Use M3x5 (Pos.13 BOM) 

Done! 

Section 11
Configuring FluidNC

Connecting the lunch box to your CNC and configuring the config.YAML file, is the very last step.
Since your controller (ESP32) might be totally different from what i used, i cant give advise here.
My connection looks something like this:



You still have to tell your CNC (FluidNC) that some other device is now talking/listening on one of the serial channels. This is done by adding the following code to your config.YAML

uart1:
  txd_pin: gpio.27
  rxd_pin: gpio.25
  baud: 115200

Make sure the Arduino Rx is connected to the ESP32 Tx and vice versa. If you cant access pin 25 and 27 on your ESP32, you can use others. Check ESP32 Dokumentation which can be configured for serial communication and change the above code accordingly.

Now all is completed. Have fun using your lunch box :)

Comments