Accelerometer

alband

Senior Member
Hi all,
I need some help with a datasheet from an accelerometer i've bought.
This is it:http://www.kionix.com/Product-Specs/KXPS5-3157 Specifications Rev 1.pdf

I am using the analogue outputs as I have never used I2C or SPI and I reckon it would be best to start those on a project where there aren't as many other potential problems. However, I'm using a 28X2 so they are a possibility. I am using the attached schematic and program with the following connections:

X to A.2
Y to A.1
Z to A.0

Enable (pin 6) = B.5
MOT Enable (pin 12) = B.4

Unfortunately, when I debug, I just get the following values:

b0 = 217
b1 = 233
b2 = 233
All give or take about 1, but it bares no correlation to the tilt of the device.

On page 11 of the datasheet, it shows a table which suggests that it produces negative values as well as normal positive. Is this right and if so, how do I measure it.

Thanks in advance,
David. :)
 

Attachments

eclectic

Moderator
@David.

Sorry, but I can't solve your problem directly.
However, a few, hopefully relevant, thoughts.

1.The “polarity” referred to on datasheet p.11 is literally “Up / Down”,
not negative / positive voltage.

2.Please can you use the “ordinary” [ / code ]when posting programs.
Uploading .bas files means
I must download / save /open Programming Editor / load program .........
I'm only one of two, who has looked at your program, so far. ;-)

3.I don't own the kionix accelerometer, but I own on of these:

http://www.dimensionengineering.com/DE-ACCM3D2.htm

I've tried a modification of your .bas program.
Code:
#PICAXE28X2
adcsetup = 4

main:	
	readadc 0,b0
	readadc 1,b1
	readadc 2,b2
	
	sertxd (#b0,"  ",#b1,"  ",#b2,cr,lf)
goto main
It works fine.
You appear to be headed in the right direction, so, first
re-check your wiring and re-check your datasheet.

e
 

alband

Senior Member
It actually started working soon after I posted this :rolleyes:, but as it appeared not to be getting any answers, I thought I might as well just let it die out, rather that bringing it back to the top just to end it. Thanks loads though for taking time to read the code. I'll try to keep point 2 in mind and also thanks for clarifying the polarity issue, I never understood that even when it started working.

Also, thanks for making me look up the sertxt command. That looks a lot faster that debugging which has been getting very annoying so that'll be very useful. :D

Thanks very much,
David.
 
Top