Hi Forum,
I'm still developing my event data logger which you have given me heaps of help with http://www.picaxeforum.co.uk/showthread.php?t=7745. This unit (now with 100nf capacitors) is going on a large mining excavator (600 tonne)
The idea is is to measure the pressure differential on the hydraulic filters when the boom passes a predermined point, or angle. That is the "event" in this case. Initially i was going to use an inductive proximity sensor, but after reading up on accelerometers as tilt sensors i found they were about the same price, and could be installed more easily (just with adhesive) on these difficult to access machines. The data sheet says the pulse width modification (duty cycle) output is "easily interfaced with a microcontroller". A walk in the park for the Picaxe i thought.
I found the PULSIN command in the manual, looked up the threads on pulsin. A one liner reads the value into a word variable. I could fine tune the limits without making a hardware change on the machine. I could put in a nice solid box with a 5V voltage regulator. I was sold.
I purchased a Sparkfun accelerometer board http://www.sparkfun.com/commerce/product_info.php?products_id=400 the ADXL202JE. which in Australia you can get overnight express post in capital cities from http://www.oceancontrols.com.au/Sensors/sfe/accelerometers_sensors.htm. These are a tiny little thing. Data sheets at both those sites.
I wired it up to the PWM output, and put in the following code, hoping to see the the value of the word variable as a number between 1 and 65535 displayed:
Instead of getting a number for the variable i just get strange characters. I know the thing is working, because when i hold it still, the characters don't change, when i rotate it they change to other strange characters, and if i rotate through one axis, only one set of characters change.
There must be something basic i am not doing , and i don't think its the Hex thing i was caught out on before. i tried state as both 1 and 0, same result. The pulsin command is simple, and the accelerometer board is designed for microcontrollers.
What am i doing wrong?
I'm still developing my event data logger which you have given me heaps of help with http://www.picaxeforum.co.uk/showthread.php?t=7745. This unit (now with 100nf capacitors) is going on a large mining excavator (600 tonne)
The idea is is to measure the pressure differential on the hydraulic filters when the boom passes a predermined point, or angle. That is the "event" in this case. Initially i was going to use an inductive proximity sensor, but after reading up on accelerometers as tilt sensors i found they were about the same price, and could be installed more easily (just with adhesive) on these difficult to access machines. The data sheet says the pulse width modification (duty cycle) output is "easily interfaced with a microcontroller". A walk in the park for the Picaxe i thought.
I found the PULSIN command in the manual, looked up the threads on pulsin. A one liner reads the value into a word variable. I could fine tune the limits without making a hardware change on the machine. I could put in a nice solid box with a 5V voltage regulator. I was sold.
I purchased a Sparkfun accelerometer board http://www.sparkfun.com/commerce/product_info.php?products_id=400 the ADXL202JE. which in Australia you can get overnight express post in capital cities from http://www.oceancontrols.com.au/Sensors/sfe/accelerometers_sensors.htm. These are a tiny little thing. Data sheets at both those sites.
I wired it up to the PWM output, and put in the following code, hoping to see the the value of the word variable as a number between 1 and 65535 displayed:
Code:
'PICAXE-18X - Read Accelerometer PWM and display it on screen terminal
Symbol y_axis = w1
symbol x_axis = w2
main:
pulsin 0,1,w1 ‘ record the length of a pulse on pin
pulsin 1,1,w2 ‘ record the length of a pulse on pin
sertxd ("y axis,",y_axis,"x axis,",x_axis,13,10)
Pause 200
goto main
There must be something basic i am not doing , and i don't think its the Hex thing i was caught out on before. i tried state as both 1 and 0, same result. The pulsin command is simple, and the accelerometer board is designed for microcontrollers.
What am i doing wrong?