Teensy 4.1 based split controller

713 views
Skip to first unread message

bil...@gmail.com

unread,
Sep 9, 2020, 4:41:34 PM9/9/20
to OpenPnP
Moving this conversation from the PeeNaPle firmware thread.

This discussion is about using multiple small Teensy 4.1 based controllers to run a OpenPnP machine.  I am using one controller, mounted in the base, to run the X and Y motors, vacuum pump, and up looking lights.  Another controller, mounted on the head, runs the Z and 2 C motors, vacuum valves, and down looking lights.  More controllers can be added to support additional nozzles.

The hardware source files are available here: https://github.com/bilsef/teensy4_pnp_controller

I am using Marlin firmware for now.  I have a branch of Marlin which I am optimizing for PnP, using this controller, here: https://github.com/bilsef/Marlin/tree/Teensy4.1_PnP

I use servo motors for X, Y, Z, and stepper motors for C.  The board has sockets for 3 stepper drivers and open collector drivers for 3 servo motors.  The Marlin configuration has to be set up to map the appropriate motor pins to X, Y and Z.

There are also 7 24V, .5A outputs, that can be switched using M42 commands, suitable for driving LED lights, valves, and relays.


serge

unread,
Sep 9, 2020, 7:00:11 PM9/9/20
to OpenPnP
that's great,   so basically it means if I have a head with only one nozzle, I can run the machine with one board only ?  and I can use the 2 other stepper  on the same board to drive a nozzle station and my push feeder ?


Waiting  for my Y '(180 W)  and (X 100 W) servo to be delivered.  Z is a 50 W servo. , iHSV57* and iHSV42 series from JMC.  Can you share the servo model you are using ?

_Serge




     

Bill Ruckman

unread,
Sep 9, 2020, 7:53:01 PM9/9/20
to ope...@googlegroups.com
@Serge, with stock Marlin you can run 4 motors (X, Y, Z, and E).  It is possible to have multiple E motors, but they have to be toggled with a tool change (T) command which is somewhat problematic for OpenPnP.  There are changes underway to add more linear axes to Marlin, but I don't know when that will be available.  The extra two stepper drivers might be useful for your nozzle station and push feeder, with a little extra work.  It sounds like you could drive them like actuators.  My main motivation for splitting it though is that I didn't want to run so many wires to the head.

I am using Yaskawa servos that I bought second hand from Ebay.  I have 100W for X, 200W for Y and 30W for Z.  X and Y are SGMJV and Z is SGMM.  The ones you have ordered should work fine.  Please let us know how it goes.




--
You received this message because you are subscribed to the Google Groups "OpenPnP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openpnp+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openpnp/1f3f499a-78ca-4499-907d-29c0e2b1198bn%40googlegroups.com.

Morpheus

unread,
Sep 11, 2020, 6:14:18 PM9/11/20
to OpenPnP
You could also interface with VESC. It has native CAN bus. Can anyone tell me the difference between BLDC and Servos. Is a BLDC with hall sensors a servo?

Here is my latest progress on the BLDC controller:

MCU : STM32F4. The VESC firmware is stable and under constant dev. Running ChibiOS. 

Mosfets : HSOF-8 Package from Infinion. Really the mosfets need to be selected for the applicaton. There is quite some difference on R(on) between 60v and 100v Mosfets within the same family.

The converter is LM5116 with up to 15 amp 12v rail. Should be enough to drive headlights, blinkers, brakelight, whipers, and so forth.

Top side is mainly wiiide copper traces. Sense resistors is made of 400um traces. 8mm wide 10mm long traces is around 0.0005ohm.


BLDC_Front.PNG

FRONT(CC-NC-BY).PNG





To unsubscribe from this group and stop receiving emails from it, send an email to ope...@googlegroups.com.

Jan Krüger

unread,
Sep 11, 2020, 8:16:44 PM9/11/20
to ope...@googlegroups.com

A servo ist a motor with position feedback, AC or DC. 

A bldc needs hall sensors to sense the position while turning to commutate the three phases accordingly. This will give a rough indication of where the rotor is but no reliable position feedback. BLDC motors are often commutated by the electromagnetic feedback of the coil which is not energized. This also only works properly on a running motor since a non rotating motor cannot induce electric fields. 

If you add another encoder with a high resolution to the bldc it becomes a servo, ie regulates it's own position. 

To unsubscribe from this group and stop receiving emails from it, send an email to openpnp+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openpnp/7f588643-9ba3-4c9b-8224-05f641a422b3o%40googlegroups.com.

Nick

unread,
Sep 12, 2020, 12:46:26 AM9/12/20
to ope...@googlegroups.com
Incase there are more than 3 servo motor, Can  multiple controller board be combined to make them work?.  Like 7 servo motors   (1 X, 2Y, 4 Z) .. 

--
You received this message because you are subscribed to the Google Groups "OpenPnP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openpnp+u...@googlegroups.com.

bert shivaan

unread,
Sep 12, 2020, 7:36:39 AM9/12/20
to OpenPnP
yes you can. openPNP allows you to have many controllers, they  are called sub-control.

Nick

unread,
Sep 12, 2020, 11:22:16 AM9/12/20
to ope...@googlegroups.com
great...I wish to make machine  like that one day...  

7 servo motors   (1 X, 2Y, 4 Z),
 2 stepper for  C axis.


Juan-Antonio Søren E. Pedersen

unread,
Sep 12, 2020, 11:57:51 AM9/12/20
to ope...@googlegroups.com

With a linear encoder on the axis, could a BLDC with hall sensors have precision holding torque ?

Juan-Antonio Søren E. Pedersen

unread,
Sep 12, 2020, 2:35:10 PM9/12/20
to OpenPnP
I bet you can make optical encoders on a lazercutter. This can be done dirt cheap.
This could provide a closed loop system on a small machine like a PnP
1-Figure1-1.png

Juan-Antonio Søren E. Pedersen

unread,
Sep 12, 2020, 2:38:48 PM9/12/20
to OpenPnP

Juan-Antonio Søren E. Pedersen

unread,
Sep 12, 2020, 4:57:34 PM9/12/20
to OpenPnP
The Teensy 4.1 has adequate processing power to monitor if a basic linear encoder is out of sync with expected behavior vs. step count. 

A simple sensor circuit with 3 or more smd emitter/sensors, could give a pretty good resolution, or reference point for expected position. 

Juan-Antonio Søren E. Pedersen

unread,
Sep 12, 2020, 5:08:05 PM9/12/20
to OpenPnP

Juan-Antonio Søren E. Pedersen

unread,
Sep 12, 2020, 5:36:38 PM9/12/20
to OpenPnP
:D Yeah baby yeah, lets put two mice on the PnP machine. 

Juan-Antonio Søren E. Pedersen

unread,
Sep 12, 2020, 5:51:56 PM9/12/20
to OpenPnP

Juan-Antonio Søren E. Pedersen

unread,
Sep 12, 2020, 8:09:45 PM9/12/20
to OpenPnP

The resolution of those optical sensors mouse sensors is not that great. I will start a new threat on magnetic encoder using this magnetic encoder tape. It should be straight forward.
https://sra-measurement.com/high-accuracy-magnetic-linear-tape

Bill Ruckman

unread,
Sep 14, 2020, 7:58:44 PM9/14/20
to ope...@googlegroups.com
I created a new Marlin branch merging the 6 axis support from here: https://github.com/DerAndere1/Marlin/tree/6axis_PR1/Marlin
It works with 5 axes (X, Y, Z, A, B).  Preliminary testing shows it to work with OpenPnP.  There are some bugs, but I don't think they affect OpenPnP.  6 axis is not working yet.

ma...@makr.zone

unread,
Sep 15, 2020, 2:05:58 AM9/15/20
to ope...@googlegroups.com

Wow, cool! Keep it going!

_Mark

ma...@makr.zone

unread,
Sep 15, 2020, 2:42:44 AM9/15/20
to ope...@googlegroups.com

Just FYI:

The new OpenPnP Motion Control also needs G92 and M114 support for all the axes. More specifically M114 with and without the R letter (M114_REALTIME)

Strangely that R letter command option is undocumented, but fortunately in the code.

https://marlinfw.org/docs/gcode/M114.html

_Mark

Bill Ruckman

unread,
Sep 15, 2020, 8:16:47 PM9/15/20
to ope...@googlegroups.com
Hi Mark,

Thanks for the heads up.  'M114 R' is mostly working.  It seems like it is not updating the final position for the extra axes though.

G1 X100 Y200 Z300 A400 B500 C600 F5000
ok
M114 R
X:8.89 Y:17.79 Z:26.68 A:35.54 B:44.44 C:53.24 E:0.00 Count X:890 Y:1781 Z:2671 A:3559 B:4449 C:5331
ok
M114 R
X:22.70 Y:45.40 Z:68.09 A:90.76 B:113.46 C:136.07 E:0.00 Count X:2271 Y:4542 Z:6813 A:9082 B:11353 C:13615
ok
M114 R
X:35.27 Y:70.54 Z:105.81 A:141.05 B:176.32 C:211.50 E:0.00 Count X:3529 Y:7057 Z:10586 A:14112 B:17641 C:21160
ok
M114 R
X:51.74 Y:103.48 Z:155.21 A:206.93 B:258.67 C:310.31 E:0.00 Count X:5176 Y:10351 Z:15527 A:20699 B:25875 C:31041
ok
M114 R
X:66.30 Y:132.60 Z:198.90 A:265.17 B:331.47 C:397.68 E:0.00 Count X:6632 Y:13264 Z:19895 A:26524 B:33156 C:39779
ok
M114 R
X:81.92 Y:163.85 Z:245.77 A:327.67 B:409.60 C:491.43 E:0.00 Count X:8194 Y:16388 Z:24582 A:32774 B:40968 C:49153
ok
M114 R
X:97.66 Y:195.32 Z:292.97 A:390.60 B:488.26 C:585.83 E:0.00 Count X:9768 Y:19535 Z:29303 A:39068 B:48835 C:58594
ok
M114 R
X:100.00 Y:200.00 Z:300.00 A:399.97 B:499.97 C:599.88 E:0.00 Count X:10000 Y:20000 Z:30000 A:39997 B:49997 C:59988
ok
M114 R
X:100.00 Y:200.00 Z:300.00 A:399.97 B:499.97 C:599.88 E:0.00 Count X:10000 Y:20000 Z:30000 A:39997 B:49997 C:59988
ok
M114
X:100.00 Y:200.00 Z:300.00 A:400.00 B:500.00 C:600.00 E:0.00 Count X:10000 Y:20000 Z:30000 A:40000 B:50000 C:60000
ok
 

ma...@makr.zone

unread,
Sep 16, 2020, 8:51:47 AM9/16/20
to ope...@googlegroups.com

Hi Bill

Rurns out, it may also work without that.

You might have seen, that I worked on (optional) asynchronous operation, i.e. the commands are no longer individually waited for, so both OpenPnP and the controller can exploit parallelisms and in case of the controller, some look-ahead strategies, to avoid deceleration.

However, because I'm no longer tracking the "ok" from the controller one by one, I now need some kind of unique and reliable "marker" in the response stream to identify when the M400 (wait for motion completion) has in deed completed. Sending an M114 R after the M400 would do that nicely, as I can then double-check the true current position, even regardless of commands sent since.

However, the coordinate comparison check is not yet implemented and still, my tests worked flawlessly so far, as the M114 reports are of course still good markers in the response stream and as long as no other Gcode issues M114 R, the REGEX match alone (without comparing coordinates) will be conclusive.

_Mark

Juan-Antonio Søren E. Pedersen

unread,
Sep 16, 2020, 10:22:52 AM9/16/20
to ope...@googlegroups.com
Hay, check out these Infineon sensors. You can have up to 4 sensors with different addresses on one SENT SPC protocol line. A four nozzle head configuration could track nozzle rotation angle with some sort of single magnet integration. 

This application note describes the SENT SPC protocol and demonstrates how to use an oscilloscope to verify a consistent Master Trigger Pulse (MTP) length.


Juan-Antonio Søren E. Pedersen

unread,
Sep 16, 2020, 11:08:13 AM9/16/20
to ope...@googlegroups.com
Are you thinking what I’m thinking ? Let’s crack this protocol! Here is a good long read on automotive protocols. 

Bill Ruckman

unread,
Sep 16, 2020, 11:29:38 AM9/16/20
to ope...@googlegroups.com
I fixed that bug.  All 6 axes seem to be working well now.

G1 X100Y200Z300A400B500C600
ok
M114 R
X:10.95 Y:21.89 Z:32.84 A:43.79 B:54.73 C:65.68 E:0.00 Count X:1095 Y:2190 Z:3285 A:4380 B:5475 C:6570
ok
M114 R
X:35.93 Y:71.86 Z:107.78 A:143.71 B:179.64 C:215.57 E:0.00 Count X:3593 Y:7187 Z:10780 A:14373 B:17967 C:21560
ok
M114 R
X:62.72 Y:125.44 Z:188.16 A:250.88 B:313.60 C:376.32 E:0.00 Count X:6273 Y:12545 Z:18818 A:25090 B:31363 C:37635
ok
M114 R
X:90.12 Y:180.24 Z:270.36 A:360.49 B:450.61 C:540.73 E:0.00 Count X:9013 Y:18025 Z:27038 A:36051 B:45063 C:54076
ok
M114 R

X:100.00 Y:200.00 Z:300.00 A:400.00 B:500.00 C:600.00 E:0.00 Count X:10000 Y:20000 Z:30000 A:40000 B:50000 C:60000
ok

Peter Homann

unread,
Jan 27, 2021, 8:02:21 PM1/27/21
to OpenPnP
Hi Bill, all,

I'm thinking of changing over to Marlin from grblHAL. I liked the latter as it is more of a CNC controller rather than a 3D printer controller, but it doesn't implement some of the G-Codes required by OpenPnP. I had a go at hacking in the M114 and M115 commands but I'm not sure I did it properly. Especially the M114 as I didn't implement the R option. As to the M400, I wouldn't know where to start.

Initially I was looking at the Duet 2 WiFi as I had one on hand but it couldn't generate the 100Khz pulse stream need to get the 60m/min rapid speeds. Also, I would need to design an interface board for it, so the Teensy4.1 seemed the way forward.

Is the fork at https://github.com/bilsef/Marlin/tree/Teensy4.1_PnP_6axis   the correct one to use?
I plan to use this controller to do the motion control of the 4 axes, the homing, limit stops, camera lights, etc.

For all of the pneumatic solenoids I plan to use another Teensy controller and write (or find and adapt) a generic G-Code processor. I want to do this as most of the pneumatics function on my YM84 machine have a solenoid and a sensor input to confirm that the solenoid has actuated correctly. The plan is to hide the sensor inputs from OpenPnP, using the controller to do the check internally and return an OK or an error if the sensor does not confirm the position of the actuator.

If you know of a generic G-Code parser library, I could use as a starting point for my sub controller, that would be a great help.

Cheers,

Peter


Bill Ruckman

unread,
Jan 28, 2021, 5:27:56 PM1/28/21
to ope...@googlegroups.com
Hi Peter,

Yes, the fork at https://github.com/bilsef/Marlin/tree/Teensy4.1_PnP_6axis  is the correct one to use.  I haven't touched it in a while, but it is what I am using currently.

For a generic gcode framework to use with your pneumatic solenoids, check out https://github.com/mgrl/0816-feeder-firmware.  You could easily adapt it to drive your solenoids using any arduino and some kind of relay driver, like this one https://www.freetronics.com.au/products/relay8-8-channel-relay-driver-shield#.YBM5_uhKj8A

Best regards,
--Bill


Reply all
Reply to author
Forward
0 new messages