Interfacing to the new HE280 accelerometer...

A place to talk about user-made mods and upgrades to their machines
User avatar
U.S. Water Rockets
Printmaster!
Posts: 157
Joined: Mon Apr 06, 2015 7:19 pm
Location: Galway, NY USA
Contact:

Re: Interfacing to the new HE280 accelerometer...

Post by U.S. Water Rockets »

mhackney wrote:I think you might be right. I've searched and perused Repetier and nothing jumps out. But I will try your suggestion to enable at the end of init.
I'd enable it and do the interrupt clear operation after the init code.

Fingers Crossed!
User avatar
mhackney
ULTIMATE 3D JEDI
Posts: 5391
Joined: Mon Mar 26, 2012 4:15 pm
Location: MA, USA
Contact:

Re: Interfacing to the new HE280 accelerometer...

Post by mhackney »

Getting closer. I enable the interrupts at the end of the INIT routine and print some status messages so I can watch what's going on in INIT. Now, I clearly see on my scope, when the sketch runs, pin 7 (Arduino) goes high and stays high. If I tap the PCB briskly, it immediately drops low and stays there. I am nit currently using the interrupt service routine and my main loop is not resetting the interrupt so this is exactly what I would expect. Next I'll reset the interrupts and see how it works.

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
User avatar
mhackney
ULTIMATE 3D JEDI
Posts: 5391
Joined: Mon Mar 26, 2012 4:15 pm
Location: MA, USA
Contact:

Got it

Post by mhackney »

Ok, I have it working predictably now. Finally! Interestingly, the CLICK interrupt is actually not enabled in the init code and even if I enable (and verify its configuration) it does not get called.

Anyway, now the next and near final step is to figure out how long the code should latch the signal on the output pin that will be read by the controller. This is probably similar to how the JohnSL board would do it with FSR probes.

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
User avatar
rurwin
Printmaster!
Posts: 68
Joined: Sat Sep 24, 2016 10:43 am
Contact:

Re: Interfacing to the new HE280 accelerometer...

Post by rurwin »

If you want to emulate the endstop, maybe you could hold the signal on until you see a medium force in the same direction (as the head pulls away from the bed.)
User avatar
mhackney
ULTIMATE 3D JEDI
Posts: 5391
Joined: Mon Mar 26, 2012 4:15 pm
Location: MA, USA
Contact:

Re: Interfacing to the new HE280 accelerometer...

Post by mhackney »

@rurwin, I had tried to do that with the other accelerometer I used last year. It actually returned direction as well as acceleration. It was problematic because of the bounce when the nozzle hits. I attempted to filter the bounce but then the firmware would sometimes detect the hit, reverse the steppers, before the bounce was done.

I have latching the signal on an output pin for 125ms working now. Next I need to hook up to a Duet and power the Arduino from the endstop connector and make sure the trigger signal is seen.

Too bad these devices are only available as a surface mount, it would be really easy to wire wrap a prototype. I've machined some small PCBs for projects in the past but not for surface mount components. I'll have to look into how to go about that. The 8 pin connector on the HE280 is a bit of a pain because 1) the male end attached to the PCB is unubtaneum in small quantities and 2) both male and female are expensive.

What I had in mind was a small board, say 15mm x 25mm, that would have a male connector on one long edge and a female on the other so it would literally just insert between the stock connector and PCB. That would be easiest approach.

An alternative would be to reuse the existing female connector (the one attached to the whip). Basically, one long edge of the board would have a row of 8 pins that would replace the wires in the press-to-connect fitting and the other long edge would have a row of 8 pads to solder the whip wires to. This requires a little more work by the user but would significantly reduce the cost.

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
User avatar
mhackney
ULTIMATE 3D JEDI
Posts: 5391
Joined: Mon Mar 26, 2012 4:15 pm
Location: MA, USA
Contact:

Re: Interfacing to the new HE280 accelerometer...

Post by mhackney »

I'm reading the temperature values from the accelerometer and trying to make sense of them. The data sheet doesn't provide an example on how to reconstruct the temperature from the data. This is what it says:
Both the OUT_TEMP_L (0Ch), OUT_TEMP_H (0Dh) registers must be read.
Temperature data is stored inside OUT_TEMP_H as two’s complement data in 8-bit format left-justified
I read both and print the value of H so I can see it. Putting my finger on the accelerometer certainly changes the data, so I an seeing temperature changes. Here's what I see for H and L at room temperature (68°F / 20°C):

H L
0b00000011 0b00000000
0x30 x00

Amy ideas on how to interpret this?

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
User avatar
U.S. Water Rockets
Printmaster!
Posts: 157
Joined: Mon Apr 06, 2015 7:19 pm
Location: Galway, NY USA
Contact:

Re: Interfacing to the new HE280 accelerometer...

Post by U.S. Water Rockets »

mhackney wrote:I'm reading the temperature values from the accelerometer and trying to make sense of them. The data sheet doesn't provide an example on how to reconstruct the temperature from the data. This is what it says:
Both the OUT_TEMP_L (0Ch), OUT_TEMP_H (0Dh) registers must be read.
Temperature data is stored inside OUT_TEMP_H as two’s complement data in 8-bit format left-justified
I read both and print the value of H so I can see it. Putting my finger on the accelerometer certainly changes the data, so I an seeing temperature changes. Here's what I see for H and L at room temperature (68°F / 20°C):

H L
0b00000011 0b00000000
0x30 x00

Amy ideas on how to interpret this?

2's compliment is the standard way signed values are represented to most microprocessors.

You get the picture from this:
0x11111111 = -1
0b00000000 = 0
0b00000001 = 1

That being said, I don't see how that works with the readings you are getting.

Does the chip scan the temperature automatically, or is there configurations needed to get it to scan the temp?
User avatar
mhackney
ULTIMATE 3D JEDI
Posts: 5391
Joined: Mon Mar 26, 2012 4:15 pm
Location: MA, USA
Contact:

Re: Interfacing to the new HE280 accelerometer...

Post by mhackney »

I know 2s compliment and that was my observation, I don't see how it works with the data I'm getting. And the "left justified" format statement. Not sure what that means, justify the MSB or ?

You configure it to return temps at initialization and then when you read the 2 temp registers (H and L) it returns the values and resets the registers until you read again.

BTW, do you have PCB experience? I need to find someone to help take this POC to a product.

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
User avatar
U.S. Water Rockets
Printmaster!
Posts: 157
Joined: Mon Apr 06, 2015 7:19 pm
Location: Galway, NY USA
Contact:

Re: Interfacing to the new HE280 accelerometer...

Post by U.S. Water Rockets »

mhackney wrote:I know 2s compliment and that was my observation, I don't see how it works with the data I'm getting. And the "left justified" format statement. Not sure what that means, justify the MSB or ?

You configure it to return temps at initialization and then when you read the 2 temp registers (H and L) it returns the values and resets the registers until you read again.

BTW, do you have PCB experience? I need to find someone to help take this POC to a product.

Left justified typically means that the field is larger than the data, so the MSB of the data is located in the MSB of the field. In this case they seem to be saying that the field is 16 bits wide (H/L registers combined) and the data is said to be 8-bits wide, so the left justified temp reading would have bit D7 of the temperature in D15 of the field.

Typically this representation is used when you have an unusual width value. For example if you had a 7-bit wide reading, and an 8-bit wide field, the "left justified" register value would be shifted left 1 bit and the LSB would be padded with a zero.

I did see in the datasheet that you have some registers to configure to make the temperature sensor read. I assume you have that going too.

Yes, I have experience designing and laying out PCB's, and have hand fabricated small batches. See this video at the 2:30 time mark for a demo of a board I did recently: https://www.youtube.com/watch?v=j6wLRHK3ATE&t=150s
Eric
Printmaster!
Posts: 717
Joined: Sat Aug 18, 2012 4:09 am
Location: Chula Vista, CA

Re: Interfacing to the new HE280 accelerometer...

Post by Eric »

2's complement is what most people expect these days. You don't actually run into 1's complement much anymore, unless you're dealing with antique hardware.

On the temperature, the answer is found in the ST forum: https://my.st.com/public/STe2ecommuniti ... Items.aspx
Look at the threads with "temperature" in the title...the answer seems to be the same for all their similar chips, which I'll paraphrase:

OUT_TEMP_H is an 8-bit signed value which is added to a reference temperature to get an absolute temperature in degrees C. The catch is, the reference temperature needs to be calibrated by the user on a per-chip basis (or so they say....you would need a quantity of them to determine otherwise). So, given your result of 0x03 for 20C, that implies your reference temperature is about 17C.

---------------------

I'd think you can dodge the whole expensive connector issue by putting your adapter board at the other end of the harness, next to the main controller. All you need to intercept are SDA/SCL/interrupt, right? Power and common ground can come from whichever main controller endstop connector you plan to use.
User avatar
mhackney
ULTIMATE 3D JEDI
Posts: 5391
Joined: Mon Mar 26, 2012 4:15 pm
Location: MA, USA
Contact:

Re: Interfacing to the new HE280 accelerometer...

Post by mhackney »

Yes, I understand how to configure the chip through the registers to read the temp. And I am sure I am getting data since I can warm the chip up and see the Temp H value increasing. But I don't know how to convert the data to an actual temperature format.

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
User avatar
mhackney
ULTIMATE 3D JEDI
Posts: 5391
Joined: Mon Mar 26, 2012 4:15 pm
Location: MA, USA
Contact:

Re: Interfacing to the new HE280 accelerometer...

Post by mhackney »

Thanks Eric, I searched for an ST forum and didn't find this one!

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
User avatar
mhackney
ULTIMATE 3D JEDI
Posts: 5391
Joined: Mon Mar 26, 2012 4:15 pm
Location: MA, USA
Contact:

Re: Interfacing to the new HE280 accelerometer...

Post by mhackney »

One of the objectives of this project is to significantly shorten that nearly 1m long I2C line from the HE280 to the controller. That is really stretching the limits of I2C and probably the primary reason you have to probe with the hotend cold, to avoid noise on the line.

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
User avatar
U.S. Water Rockets
Printmaster!
Posts: 157
Joined: Mon Apr 06, 2015 7:19 pm
Location: Galway, NY USA
Contact:

Re: Interfacing to the new HE280 accelerometer...

Post by U.S. Water Rockets »

mhackney wrote:I know 2s compliment and that was my observation, I don't see how it works with the data I'm getting. And the "left justified" format statement. Not sure what that means, justify the MSB or ?

You configure it to return temps at initialization and then when you read the 2 temp registers (H and L) it returns the values and resets the registers until you read again.

BTW, do you have PCB experience? I need to find someone to help take this POC to a product.

I think I have the answer for the temperature sensor. I found some info for one of the other ST accelerometers which is similar and has the same register descriptions:

"The temperature sensor can be used to measure temperature variations. It isn't suitable to return absolute temperatures measures. The value represents difference respect to a reference not specified value."

It looks like you have 1 degree of temperature resolution, and you have to record a calibration offset at a known temperature and then use the delta to determine the actual temperature. The sensor is not factory calibrated.
User avatar
mhackney
ULTIMATE 3D JEDI
Posts: 5391
Joined: Mon Mar 26, 2012 4:15 pm
Location: MA, USA
Contact:

Re: Interfacing to the new HE280 accelerometer...

Post by mhackney »

Just to capture the temp info, this is the most relevant post IIS2DH temperature sensor data
The temperature sensor can be used to measure temperature variations. It isn't suitable to return absolute temperatures measures. The value represents difference respect to a reference not specified value.

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
User avatar
mhackney
ULTIMATE 3D JEDI
Posts: 5391
Joined: Mon Mar 26, 2012 4:15 pm
Location: MA, USA
Contact:

Re: Interfacing to the new HE280 accelerometer...

Post by mhackney »

Yeah, my post is for the IIS2DH. But to use it for a safety mechanism to shut down or alarm if too hot, an big delta and not an exact temperature would be all you need.

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
User avatar
U.S. Water Rockets
Printmaster!
Posts: 157
Joined: Mon Apr 06, 2015 7:19 pm
Location: Galway, NY USA
Contact:

Re: Interfacing to the new HE280 accelerometer...

Post by U.S. Water Rockets »

mhackney wrote:One of the objectives of this project is to significantly shorten that nearly 1m long I2C line from the HE280 to the controller. That is really stretching the limits of I2C and probably the primary reason you have to probe with the hotend cold, to avoid noise on the line.
You're correct. I was concerned about the same thing. I thought the accelerometer probe worked with an endstop input and local CPU until info came out that it was I2C. I was impressed that it worked this way at all, based on my experience with I2C. I would guess the cycling of the PWM for the heater or fan would really wreak havoc with the I2C bus.

I suggest using a I2C differential driver like this one:

http://www.ti.com/lit/ds/symlink/p82b715.pdf

50 meters of differential pair signal. Use twisted pair wire. Bulletproof.
User avatar
mhackney
ULTIMATE 3D JEDI
Posts: 5391
Joined: Mon Mar 26, 2012 4:15 pm
Location: MA, USA
Contact:

Re: Interfacing to the new HE280 accelerometer...

Post by mhackney »

And that's exactly what happens! If the hotend is on when you probe, bad things happen.

Do you need one of those drivers at each end?

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
User avatar
U.S. Water Rockets
Printmaster!
Posts: 157
Joined: Mon Apr 06, 2015 7:19 pm
Location: Galway, NY USA
Contact:

Re: Interfacing to the new HE280 accelerometer...

Post by U.S. Water Rockets »

mhackney wrote:And that's exactly what happens! If the hotend is on when you probe, bad things happen.

Do you need one of those drivers at each end?
Yeah. Technically one chip on each end of the long run I2C bus.
User avatar
U.S. Water Rockets
Printmaster!
Posts: 157
Joined: Mon Apr 06, 2015 7:19 pm
Location: Galway, NY USA
Contact:

Re: Interfacing to the new HE280 accelerometer...

Post by U.S. Water Rockets »

It looks like it comes in a 8-pin PDIP package, if you wanted to play with them.

If you think you would like the try this, I suggest you sign up for an account on TI and request samples. They are really good with stuff like that.

An advantage to doing it over I2C is you don't have to worry about firmware updates on the remote mounted microcontroller.
User avatar
mhackney
ULTIMATE 3D JEDI
Posts: 5391
Joined: Mon Mar 26, 2012 4:15 pm
Location: MA, USA
Contact:

Re: Interfacing to the new HE280 accelerometer...

Post by mhackney »

I'm not really worried about that. The JohnSL board for FSRs and even David's IR probe are both good examples. Simple products.

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
User avatar
rurwin
Printmaster!
Posts: 68
Joined: Sat Sep 24, 2016 10:43 am
Contact:

Re: Interfacing to the new HE280 accelerometer...

Post by rurwin »

The Chinese PCB manufacturers can do board assembly as well. Here's one with an online estimater: http://www.7pcbassembly.com/turnkey-pcb-assembly.php

I've not ordered anything from them, and you would have to be careful, but worth seeing if it makes sense. From a quick play it looks like 10 boards would be ~$50 each but 100 boards would be ~$8 each. (Plus parts of course).
User avatar
mhackney
ULTIMATE 3D JEDI
Posts: 5391
Joined: Mon Mar 26, 2012 4:15 pm
Location: MA, USA
Contact:

Re: Interfacing to the new HE280 accelerometer...

Post by mhackney »

It's not the assembly I need help with yet, its the design of the board from the prototype.

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
User avatar
U.S. Water Rockets
Printmaster!
Posts: 157
Joined: Mon Apr 06, 2015 7:19 pm
Location: Galway, NY USA
Contact:

Re: Interfacing to the new HE280 accelerometer...

Post by U.S. Water Rockets »

mhackney wrote:It's not the assembly I need help with yet, its the design of the board from the prototype.
I'd be happy to help out with that, if you settle on a design.

If I understand what you're looking for, it would be very similar to my recent altimeter project. Is this the sort of thing you're looking for?
Scale_Penny.jpg
User avatar
mhackney
ULTIMATE 3D JEDI
Posts: 5391
Joined: Mon Mar 26, 2012 4:15 pm
Location: MA, USA
Contact:

Re: Interfacing to the new HE280 accelerometer...

Post by mhackney »

Basically. It will need the HE280 connector on one long edge and pads for the 8 wires on the other. The processor chip and 5v regulator (maybe depending on processor) and an LED to show the touch and relay messages on startup. I'm also thinking a row of four 2 pin headers to use for setting the sensitivity with jumpers and another to select NO or NC behavior. I can write this up and also make a drawing of the basic format and how I'd like to attach it between the whip and hot end.

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 “Mods and Upgrades”