Page 1 of 2

Duet HE280 Probe i2c interface

Posted: Mon Dec 12, 2016 8:14 pm
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.

Re: Duet HE280 Probe i2c interface

Posted: Mon Dec 12, 2016 10:14 pm
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?

Re: Duet HE280 Probe i2c interface

Posted: Tue Dec 13, 2016 3:11 am
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. :)

Re: Duet HE280 Probe i2c interface

Posted: Tue Dec 13, 2016 3:21 am
by DerStig
Oh damn! Thanks! I can make that work and I will!

Re: Duet HE280 Probe i2c interface

Posted: Tue Dec 13, 2016 8:03 am
by Jimustanguitar
Is this similar to what MHackney has done? Also for the Duet, interestingly.

Re: Duet HE280 Probe i2c interface

Posted: Tue Dec 13, 2016 12:03 pm
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.

Re: Duet HE280 Probe i2c interface

Posted: Tue Dec 13, 2016 1:02 pm
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 ;)

Re: Duet HE280 Probe i2c interface

Posted: Tue Dec 13, 2016 1:24 pm
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.

Re: Duet HE280 Probe i2c interface

Posted: Tue Dec 13, 2016 3:33 pm
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!

Re: Duet HE280 Probe i2c interface

Posted: Tue Dec 13, 2016 3:35 pm
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?

Re: Duet HE280 Probe i2c interface

Posted: Tue Dec 13, 2016 3:43 pm
by mhackney
Indeterminate since The boards were delayed in manufacturing :(

Re: Duet HE280 Probe i2c interface

Posted: Tue Dec 13, 2016 5:04 pm
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.

Re: Duet HE280 Probe i2c interface

Posted: Tue Dec 13, 2016 5:47 pm
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.

Re: Duet HE280 Probe i2c interface

Posted: Tue Dec 13, 2016 6:14 pm
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.

Re: Duet HE280 Probe i2c interface

Posted: Tue Dec 13, 2016 6:22 pm
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!

Re: Duet HE280 Probe i2c interface

Posted: Tue Dec 13, 2016 6:48 pm
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....

Re: Duet HE280 Probe i2c interface

Posted: Tue Dec 13, 2016 7:09 pm
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.

Re: Duet HE280 Probe i2c interface

Posted: Tue Dec 13, 2016 7:13 pm
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.

Re: Duet HE280 Probe i2c interface

Posted: Tue Dec 13, 2016 7:20 pm
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.

Re: Duet HE280 Probe i2c interface

Posted: Tue Dec 13, 2016 7:24 pm
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.

Re: Duet HE280 Probe i2c interface

Posted: Tue Dec 13, 2016 9:31 pm
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. :)

Re: Duet HE280 Probe i2c interface

Posted: Tue Dec 13, 2016 10:40 pm
by crocky
Excellent.... I just ordered a teensy and it will probably arrive sooner than the duet :)

Re: Duet HE280 Probe i2c interface

Posted: Wed Dec 14, 2016 3:54 am
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.

Re: Duet HE280 Probe i2c interface

Posted: Wed Dec 14, 2016 11:48 am
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! :)

Re: Duet HE280 Probe i2c interface

Posted: Wed Dec 14, 2016 11:53 am
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.