0

Help with this controller 's substitution project
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Re: Help with this controller 's substitution project

by dastels on Wed Oct 30, 2019 11:08 am

You got the ADXL345, right?

The place to start is https://learn.adafruit.com/adxl345-digital-accelerometer for details on it's use.

Dave

dastels
 
Posts: 700
Joined: Tue Oct 20, 2015 3:22 pm

Re: Help with this controller 's substitution project

by marco2178 on Wed Oct 30, 2019 12:32 pm

Yes. I have got two ADXL345 - Triple-Axis Accelerometer (+-2g/4g/8g/16g) w/ I2C/SPI .

I would use them both to control 1/2 of the rotation of a servomotor. The other 1/2 of the rotatuon of the same servomotor is instead controller by 2 pressure sensors.

So to recap, i use 2 pressure sensors and 2 accelerometers to control 1 servomotor

Thanks

marco2178
 
Posts: 15
Joined: Sat Sep 07, 2019 12:27 pm

Re: Help with this controller 's substitution project

by marco2178 on Wed Oct 30, 2019 3:18 pm

Forgot to mention, that i would need only the y axe enabled. I do not use any other axe

marco2178
 
Posts: 15
Joined: Sat Sep 07, 2019 12:27 pm

Re: Help with this controller 's substitution project

by dastels on Wed Oct 30, 2019 3:27 pm

You can just ignore the other values.

dastels
 
Posts: 700
Joined: Tue Oct 20, 2015 3:22 pm

Re: Help with this controller 's substitution project

by marco2178 on Wed Oct 30, 2019 6:49 pm

Teh problem remains that I have no clue how to set the 2 accelerometrs in my code. any help please with that ?

marco2178
 
Posts: 15
Joined: Sat Sep 07, 2019 12:27 pm

Re: Help with this controller 's substitution project

by dastels on Wed Oct 30, 2019 8:14 pm

The place to start is https://learn.adafruit.com/adxl345-digital-accelerometer.

The ADXL345 gives you he ability to use 1 of 2 I2C addresses. From the data sheet:

With CS tied high to VDD I/O, the ADXL345 is in I2C mode,
requiring a simple 2-wire connection, as shown in Figure 40.
The ADXL345 conforms to the UM10204 I
2C-Bus Specification
and User Manual, Rev. 03—19 June 2007, available from NXP
Semiconductors. It supports standard (100 kHz) and fast (400 kHz)
data transfer modes if the bus parameters given in Table 11
and Table 12 are met. Single- or multiple-byte reads/writes are
supported, as shown in Figure 41. With the ALT ADDRESS pin
high, the 7-bit I2C address for the device is 0x1D, followed by
the R/W bit. This translates to 0x3A for a write and 0x3B for a
read. An alternate I2C address of 0x53 (followed by the R/W bit)
can be chosen by grounding the ALT ADDRESS pin (Pin 12).
This translates to 0xA6 for a write and 0xA7 for a read.
There are no internal pull-up or pull-down resistors for any
unused pins; therefore, there is no known state or default state
for the CS or ALT ADDRESS pin if left floating or unconnected.
It is required that the CS pin be connected to VDD I/O and that
the ALT ADDRESS


In the code you have to create two instances and pass the respective I2C address to each begin() call. Something like:

Code: Select all | TOGGLE FULL SIZE
Adafruit_ADXL345_Unified accel1 = Adafruit_ADXL345_Unified(1);
Adafruit_ADXL345_Unified accel2 = Adafruit_ADXL345_Unified(2);

.
.
.

accel1.begin(0x1D);
accel2.begin(0x53);


From there on you use accel1 and accel2 as you wish.

dastels
 
Posts: 700
Joined: Tue Oct 20, 2015 3:22 pm

Re: Help with this controller 's substitution project

by marco2178 on Thu Oct 31, 2019 11:26 pm

Is there any video tutorial of a step by step guide to connect the 2 acceleromwters ti an arduino uno and run a code for testing the different options/settings of the 2 accelerometers.

I think the 1st step would be undwrstanding the 2 accelerometers and each single option/settings.

If i understood correctly, there are settings to set up for these 2 accelerometers, based on the use we want to do of them. The base settings might not be optimal for my project. So how can i play a little with settings and test the 2 accelerometers using different settings?

marco2178
 
Posts: 15
Joined: Sat Sep 07, 2019 12:27 pm

Re: Help with this controller 's substitution project

by dastels on Fri Nov 01, 2019 10:10 am

There's always the datasheet which is the canonical reference: http://www.analog.com/static/imported-files/data_sheets/ADXL345.pdf

dastels
 
Posts: 700
Joined: Tue Oct 20, 2015 3:22 pm

Re: Help with this controller 's substitution project

by marco2178 on Fri Nov 01, 2019 11:16 am

Unfortunately that is not enough for helping me and if i can't figure out how to use these accelerometers, they become useless and maybe a return

marco2178
 
Posts: 15
Joined: Sat Sep 07, 2019 12:27 pm

Please be positive and constructive with your questions and comments.