Duet HE280 Probe i2c interface

The new for 2016 RostockMAX v3!
trash80
Plasticator
Posts: 18
Joined: Mon Dec 12, 2016 5:01 pm

Duet HE280 Probe i2c interface

Post by trash80 »

I wrote a simple program that converts the HE280 Probe i2c accelerometer for use with the Duet Wifi using a Teensy 3. The Pro Mini 3v version would also work as well. The key is it has to be 5v tolerant because of the level shifting on the HE280 PCB to 5v and it has to output 3v for the Duet, So either a 3v micro that is 5v tolerant or a level shifter is required.

The code is up on github here, not much for documentation but it's very very simple. The pins are described in the .ino file.
https://github.com/trash80/HE280AccelerometerInterface

Here's the little guy wired up and ready to be installed. You can see the limit switch line at the top, the E0 3 pin connection, i2c mating input, and the "int" 2 pin connector. Note: this has now been changed to use the MOD pin on the 4 pin Z Probe connector.
[img]http://trash80.com/junkfood/teensyhe280.jpg[/img]

Here's a video of one of my test runs:
https://www.youtube.com/watch?v=QkDeiUMv68M

Note: I have had a few failed attempts at calibration now with the hotend hot, keep it under 40C for successful results with this approach.
Last edited by trash80 on Tue Dec 13, 2016 9:29 pm, edited 3 times in total.
DerStig
Printmaster!
Posts: 160
Joined: Fri Feb 20, 2015 3:00 am

Re: Duet HE280 Probe i2c interface

Post by DerStig »

I have no idea what you just wrote but I want it.

so what you are saying is that I can use that with the Accel board and a E3D hotend on my MetalMax with a Duet WiFi board. Could you dumb down the post so I can do it?
trash80
Plasticator
Posts: 18
Joined: Mon Dec 12, 2016 5:01 pm

Re: Duet HE280 Probe i2c interface

Post by trash80 »

DerStig wrote:I have no idea what you just wrote but I want it.

so what you are saying is that I can use that with the Accel board and a E3D hotend on my MetalMax with a Duet WiFi board. Could you dumb down the post so I can do it?
EDIT: Changed to use the Z-probe connections on the Duet and updated code & wire diagram below

Yes.

I can try though this is probably a more advanced topic and should be taken with care. You may need to tweak the accelerometer sensitivity on your setup (located in the accelerometer.ino file) or adjust speeds for triggering to work reliably. I only have the one printer I tested with.

I used a Teensy 3.2 because I happened to have a few around the shop, and they are fast to develop with. You can get them at pjrc.com or SparkFun, Adafruit, Amazon, etc. It's a $20 Arduino compatible microcontroller, you need to download and install Teensyduino from pjrc.com though.

(An advanced user could get away with a much lighter weight microcontroller, such as a Pro Mini or an Attiny with some logic level conversion)


- Download the code available here https://github.com/trash80/HE280AccelerometerInterface which can be flashed using the Arduino application.
- Connect the HE280's SCL, SDA, and INT lines into the Teensy's pins 19,18, and 2 respectively.
- Connect the Teensy pins to Duet Z-Probe 4 pin connector... Teensy Pin 13 -> Z_PROBE_IN, Pin 3 -> Z_PROBE_MOD, 3.3v -> 3.3v, GND -> GND.
- Edit config.g and add or change the M558 command:

Code: Select all

M558 P5 X0 Y0 Z1 H10 F1100 T6000   ; Z probe is an digital output probe and is not used for homing any axes
- Edit bed.g and replace the G28 home command at the top of the file with the following:
Edit: For more rencent versions of Duet software, this step is not required: Versions 1.17b and above.

Code: Select all

M558 P3                  ; drive mod pin on Probe Z connector LOW
G28                        ; home the printer
M558 P1                  ; drive mod pin on Probe Z connector HIGH
M558 P5                  ; release mod pin connector and set the type to 5
- Finally you can reset the Duet and try the probe, you may need to add a offset to z probe offset after calibration to fine tune (I don't know why, maybe because my bed is sorta slightly flexible), I used G31 X0 Y0 Z-0.3 P500
- Last note, run the probe after a restart and the hotend is at room temperature.

I made a super simple diagram for the HE280 to connect to the Duet- though you should not use this as reference, there might be a mistake (I double checked it but you never know)

[img]https://github.com/trash80/HE280Acceler ... g?raw=true[/img]

I have not had any probing issues as discussed in the forum elsewhere due to the i2c wire length, except when trying to probe after a print which may be something I can look into later, because upon power up it works every time. :)
Last edited by trash80 on Sun Mar 19, 2017 9:42 pm, edited 7 times in total.
DerStig
Printmaster!
Posts: 160
Joined: Fri Feb 20, 2015 3:00 am

Re: Duet HE280 Probe i2c interface

Post by DerStig »

Oh damn! Thanks! I can make that work and I will!
User avatar
Jimustanguitar
ULTIMATE 3D JEDI
Posts: 2631
Joined: Sun Mar 31, 2013 1:35 am
Location: Notre Dame area
Contact:

Re: Duet HE280 Probe i2c interface

Post by Jimustanguitar »

Is this similar to what MHackney has done? Also for the Duet, interestingly.
trash80
Plasticator
Posts: 18
Joined: Mon Dec 12, 2016 5:01 pm

Re: Duet HE280 Probe i2c interface

Post by trash80 »

Jimustanguitar wrote:Is this similar to what MHackney has done? Also for the Duet, interestingly.
Yup! I figured I can keep things very similar to the rambo setup with i2c, at least for a testing/temporary/quick solution. I am sharing it because it seems to work pretty well for me, next time I am at my shop I'll try scoping the lines and see how noisy they are.

TL;DR - This is the only option while keeping the original HE280 PCB. I think MHackney's solution of moving the controller close to or on the same board as the accelerometer is much better, especially if there is noise interfering with the i2c bus. However at least on the forum there is no actual evidence of this happening- ie: probing the i2c lines with a oscope, which I want to do for science. The talk about using a ferrite bead on the tether just made me think there was a slack or a connection issue on the tether, which was fixed by altering the cable itself. How the i2c communication works is the firmware sends some settings via i2c, and after the probing process is started, the only thing "read" back is just a voltage on a wire- not i2c, if it was an interference issue, the hotend would try to drive itself through the bed.
rocky00717
Plasticator
Posts: 8
Joined: Tue Oct 04, 2016 1:23 pm

Re: Duet HE280 Probe i2c interface

Post by rocky00717 »

Hey do you know if an arduino nano will work? I know the clock is much slower but i have a whole drawer full of them.
Never used Teensy, is the code similar to arduino?

Ill order a Teensy if i have to but would be good to use what i have ;)
rocky00717
Plasticator
Posts: 8
Joined: Tue Oct 04, 2016 1:23 pm

Re: Duet HE280 Probe i2c interface

Post by rocky00717 »

Ok disregard last post. I ordered a Teensy. Once i have this connected will it work with the duet wifi firmware or is there anything special that needs to be set to make it work? For example since you used the E0 for the probe and the Z-probe for init.

This is great BTW! Very much looking forward to finally getting this board hooked up.
User avatar
mhackney
ULTIMATE 3D JEDI
Posts: 5412
Joined: Mon Mar 26, 2012 4:15 pm
Location: MA, USA
Contact:

Re: Duet HE280 Probe i2c interface

Post by mhackney »

Yes, its a nice job. The primary differences are:

1) I attach mine AT the HE280 so there is no long I2C run
2) I'm using an ATTiny85 (cheap)
3) I'm testing the wazoo out of mine and
4) I'm having a little board made with 3 pin connectors at each end that just plug into the HE280 and an endstop harness at opposite ends

I added an LED for status messages and to signal probing too. But this one works and can be programmed without a special programmer like the Sparkfun Tiny Programmer.

Nice job!

Sublime Layers - my blog on Musings and Experiments in 3D Printing Technology and Art

Start Here:
A Strategy for Successful (and Great) Prints

Strategies for Resolving Print Artifacts

The Eclectic Angler
DerStig
Printmaster!
Posts: 160
Joined: Fri Feb 20, 2015 3:00 am

Re: Duet HE280 Probe i2c interface

Post by DerStig »

mhackney wrote:Yes, its a nice job. The primary differences are:

1) I attach mine AT the HE280 so there is no long I2C run
2) I'm using an ATTiny85 (cheap)
3) I'm testing the wazoo out of mine and
4) I'm having a little board made with 3 pin connectors at each end that just plug into the HE280 and an endstop harness at opposite ends

I added an LED for status messages and to signal probing too. But this one works and can be programmed without a special programmer like the Sparkfun Tiny Programmer.

Nice job!

When is yours going to be ready for sale?
User avatar
mhackney
ULTIMATE 3D JEDI
Posts: 5412
Joined: Mon Mar 26, 2012 4:15 pm
Location: MA, USA
Contact:

Re: Duet HE280 Probe i2c interface

Post by mhackney »

Indeterminate since The boards were delayed in manufacturing :(

Sublime Layers - my blog on Musings and Experiments in 3D Printing Technology and Art

Start Here:
A Strategy for Successful (and Great) Prints

Strategies for Resolving Print Artifacts

The Eclectic Angler
geneb
ULTIMATE 3D JEDI
Posts: 5362
Joined: Mon Oct 15, 2012 12:47 pm
Location: Graham, WA
Contact:

Re: Duet HE280 Probe i2c interface

Post by geneb »

mhackney wrote:Indeterminate since The boards were delayed in manufacturing :(
I'm probably going to hell for this....I take it you got an email from Some Ting Wong? :D

g.
Delta Power!
Defeat the Cartesian Agenda!
http://www.f15sim.com - 80-0007, The only one of its kind.
http://geneb.simpits.org - Technical and Simulator Projects
trash80
Plasticator
Posts: 18
Joined: Mon Dec 12, 2016 5:01 pm

Re: Duet HE280 Probe i2c interface

Post by trash80 »

geneb wrote: I'm probably going to hell for this....I take it you got an email from Some Ting Wong? :D

g.
How is Hell this time of year? I guess you get a heated bed at least.
dc42
Printmaster!
Posts: 454
Joined: Mon Mar 07, 2016 10:17 am

Re: Duet HE280 Probe i2c interface

Post by dc42 »

trash80 wrote:I wrote a simple program that converts the HE280 Probe i2c accelerometer for use with the Duet Wifi using a Teensy 3. The Pro Mini 3v version would also work as well. The key is it has to be 5v tolerant because of the level shifting on the HE280 PCB to 5v and it has to output 3v for the Duet, So either a 3v micro that is 5v tolerant or a level shifter is required.

The Duet E0 probe connection is used for 3v power, gnd and the trigger signal and configured as using the auto probe type #4.
I used one of the homing limit switch signals as a "reset" signal to make sure that the accelerometer is initialized with the correct values before probing. IE: a pin is wired in parallel to one of the switches.

The code is up on github here, not much for documentation but it's very very simple. The pins are described in the .ino file.
https://github.com/trash80/HE280AccelerometerInterface

Here's the little guy wired up and ready to be installed. You can see the limit switch line at the top, the E0 3 pin connection, i2c mating input, and the "int" 2 pin connector.
[img]http://trash80.com/junkfood/teensyhe280.jpg[/img]

Here's a video of one of my test runs:
https://www.youtube.com/watch?v=QkDeiUMv68M

I've since slowed down the speed in config.g via: (it doesn't bash as hard on the glass bed and give me a 0.01 to 0.02 deviation)

Code: Select all

M558 P4 X0 Y0 Z1 H10 F1000 T5000	; Z probe is an IR probe and is not used for homing any axes
Note: I have had a few failed attempts at calibration now with the hotend hot, keep it under 40C for successful results with this approach.
Nice work!

Have you considered connecting the Teensy to the 4 pin Z probe connector instead of to the E0 endstop connector? You could use the Mod pin on the Z probe connector to do the reset. Selecting probe type 3 in the M558 command will drive that signal low, then select type 5 before you probe to drive it high.
trash80
Plasticator
Posts: 18
Joined: Mon Dec 12, 2016 5:01 pm

Re: Duet HE280 Probe i2c interface

Post by trash80 »

dc42 wrote: Have you considered connecting the Teensy to the 4 pin Z probe connector instead of to the E0 endstop connector? You could use the Mod pin on the Z probe connector to do the reset. Selecting probe type 3 in the M558 command will drive that signal low, then select type 5 before you probe to drive it high.
Oh wow didn't know that! I've had the Duet now for about a week so I have much learning to do. :) Yeah I don't recall why I used E0 after seeing the Z probe input. Maybe I got lost. :)

I'll give it a try and change the stuff mentioned above. Thanks!
User avatar
crocky
Printmaster!
Posts: 270
Joined: Tue Aug 12, 2014 6:55 pm
Location: Werribee, Aust

Re: Duet HE280 Probe i2c interface

Post by crocky »

This is looking interesting too.

I have just ordered a Duet WiFi, a 7" Display and the IR probe board... Not here yet but they have sent it, ordered mine from England. Not sure which way to go at the moment because I do have a HE280 that is working well at present!

This upgrading business is a continual thing... Next....
Bob
Rostock Max V2, Ball Cup Arms, New Carriages, HE280, Dampers, PSU Breathing, Simplify 3D, GeckoTek3D, Raspberry Pi3. Duet soon... Kossel Mini still under construction.
Delta's are the way!
trash80
Plasticator
Posts: 18
Joined: Mon Dec 12, 2016 5:01 pm

Re: Duet HE280 Probe i2c interface

Post by trash80 »

dc42 wrote: Have you considered connecting the Teensy to the 4 pin Z probe connector instead of to the E0 endstop connector? You could use the Mod pin on the Z probe connector to do the reset. Selecting probe type 3 in the M558 command will drive that signal low, then select type 5 before you probe to drive it high.
Update: I got it to work. Though it appears flipping between type 3 and 5 leaves the mod pin state LOW, so it only triggers once, I got it working by going to type 3, than type 1 to drive it HIGH, then finally to type 5 to probe on. :)

In config.g:

Code: Select all

M558 P5 X0 Y0 Z1 H10 F1000 T6000	; Z probe is an digital output probe and is not used for homing any axes
And at the top of bed.g

Code: Select all

; Auto calibration routine for delta printers
; Before running this, you should have set up your zprobe Z offset to suit your build, in the G31 command in config.g.

M561						; clear any bed transform, otherwise homing may be at the wrong height
G31 X0 Y0					; don't want any probe offset for this
M558 P3						; drive mod pin on Probe Z connector LOW
G28						; home the printer
M558 P1						; drive mod pin on Probe Z connector HIGH
M558 P5						; release mod pin connector and set the type to 5
I'll be updating the first post and pics and codebase to reflect the changes shortly.
User avatar
mhackney
ULTIMATE 3D JEDI
Posts: 5412
Joined: Mon Mar 26, 2012 4:15 pm
Location: MA, USA
Contact:

Re: Duet HE280 Probe i2c interface

Post by mhackney »

@trash80 (great name by the way, I wonder how many people get it!) - in your photo it looks like you have 3 wires going to the 4 pin I2C male connector. Is that just as shadow? There are only 2 wires on the connector from the whip.

Sublime Layers - my blog on Musings and Experiments in 3D Printing Technology and Art

Start Here:
A Strategy for Successful (and Great) Prints

Strategies for Resolving Print Artifacts

The Eclectic Angler
trash80
Plasticator
Posts: 18
Joined: Mon Dec 12, 2016 5:01 pm

Re: Duet HE280 Probe i2c interface

Post by trash80 »

mhackney wrote:@trash80 (great name by the way, I wonder how many people get it!) - in your photo it looks like you have 3 wires going to the 4 pin I2C male connector. Is that just as shadow? There are only 2 wires on the connector from the whip.
Thanks. I own the .com and such. :)
It's just a shadow, I made the thing pin compatible with the stock whip. Again though I'll be moving the connections to the Z probe on the Duet. Working on the graphics now and the git repo has been updated for this.
User avatar
mhackney
ULTIMATE 3D JEDI
Posts: 5412
Joined: Mon Mar 26, 2012 4:15 pm
Location: MA, USA
Contact:

Re: Duet HE280 Probe i2c interface

Post by mhackney »

Great, thanks. The Duet 4 pin probe connector is good as David describes. You can also use the 4th line to do things like set sensitivity, etc. The only minor downside is it is Duet specific whereas the end stop version will work on basically all firmware that supports probing.

Sublime Layers - my blog on Musings and Experiments in 3D Printing Technology and Art

Start Here:
A Strategy for Successful (and Great) Prints

Strategies for Resolving Print Artifacts

The Eclectic Angler
trash80
Plasticator
Posts: 18
Joined: Mon Dec 12, 2016 5:01 pm

Re: Duet HE280 Probe i2c interface

Post by trash80 »

My posts above have been modified, code on github changed, and the simple wire diagram has been redone to reflect moving the wires to the z probe connector as suggested by dc42. :)
User avatar
crocky
Printmaster!
Posts: 270
Joined: Tue Aug 12, 2014 6:55 pm
Location: Werribee, Aust

Re: Duet HE280 Probe i2c interface

Post by crocky »

Excellent.... I just ordered a teensy and it will probably arrive sooner than the duet :)
Bob
Rostock Max V2, Ball Cup Arms, New Carriages, HE280, Dampers, PSU Breathing, Simplify 3D, GeckoTek3D, Raspberry Pi3. Duet soon... Kossel Mini still under construction.
Delta's are the way!
dc42
Printmaster!
Posts: 454
Joined: Mon Mar 07, 2016 10:17 am

Re: Duet HE280 Probe i2c interface

Post by dc42 »

trash80 wrote:
dc42 wrote: Have you considered connecting the Teensy to the 4 pin Z probe connector instead of to the E0 endstop connector? You could use the Mod pin on the Z probe connector to do the reset. Selecting probe type 3 in the M558 command will drive that signal low, then select type 5 before you probe to drive it high.
Update: I got it to work. Though it appears flipping between type 3 and 5 leaves the mod pin state LOW, so it only triggers once, I got it working by going to type 3, than type 1 to drive it HIGH, then finally to type 5 to probe on. :)

In config.g:

Code: Select all

M558 P5 X0 Y0 Z1 H10 F1000 T6000	; Z probe is an digital output probe and is not used for homing any axes
And at the top of bed.g

Code: Select all

; Auto calibration routine for delta printers
; Before running this, you should have set up your zprobe Z offset to suit your build, in the G31 command in config.g.

M561						; clear any bed transform, otherwise homing may be at the wrong height
G31 X0 Y0					; don't want any probe offset for this
M558 P3						; drive mod pin on Probe Z connector LOW
G28						; home the printer
M558 P1						; drive mod pin on Probe Z connector HIGH
M558 P5						; release mod pin connector and set the type to 5
I'll be updating the first post and pics and codebase to reflect the changes shortly.
I'm glad you got it working. Looks like the firmware doesn't set the control pin state when switching to probe type 5. I'll fix that in the 1.17 release to drive it high.
trash80
Plasticator
Posts: 18
Joined: Mon Dec 12, 2016 5:01 pm

Re: Duet HE280 Probe i2c interface

Post by trash80 »

dc42 wrote: I'm glad you got it working. Looks like the firmware doesn't set the control pin state when switching to probe type 5. I'll fix that in the 1.17 release to drive it high.
Nice. Thank you for all of your work, it's much appreciated! :)
User avatar
mhackney
ULTIMATE 3D JEDI
Posts: 5412
Joined: Mon Mar 26, 2012 4:15 pm
Location: MA, USA
Contact:

Re: Duet HE280 Probe i2c interface

Post by mhackney »

And the 1.17 release has the delta grid based compensation in it. You think dc42's delta calibration is good, wait until you see this. It will take out those odd gremlins that calibration doesn't address including things like warped bed surfaces and odd non-planar nozzle moves.

Sublime Layers - my blog on Musings and Experiments in 3D Printing Technology and Art

Start Here:
A Strategy for Successful (and Great) Prints

Strategies for Resolving Print Artifacts

The Eclectic Angler
Post Reply

Return to “RostockMAX v3”