Hello people , i got into a problem
while i do the TCAscan it shows me every I2C sensor connected , once i try any ADXL345 test it says no ADXL found and that i should check the wiring , it's making me crazy for 3days already. Please HELP :(
i have to say that i am pretty new to all this as well
ADXL345 and TCA9548A
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- adafruit_support_bill
- Posts: 88093
- Joined: Sat Feb 07, 2009 10:11 am
Re: ADXL345 and TCA9548A
Please post a photo showing your soldering and connections.
Also please post a sample of the TCAscan output.
Also please post a sample of the TCAscan output.
- yujundimo
- Posts: 4
- Joined: Fri Apr 20, 2018 8:32 am
Re: ADXL345 and TCA9548A
TCAScanner ready!
TCA Port #0
TCA Port #1
TCA Port #2
Found I2C 0x53
TCA Port #3
TCA Port #4
Found I2C 0x53
TCA Port #5
TCA Port #6
TCA Port #7
Found I2C 0x53
done
this one gives me check the wiring feedback
TCA Port #0
TCA Port #1
TCA Port #2
Found I2C 0x53
TCA Port #3
TCA Port #4
Found I2C 0x53
TCA Port #5
TCA Port #6
TCA Port #7
Found I2C 0x53
done
Code: Select all
/**
* TCA9548 I2CScanner.pde -- I2C bus scanner for Arduino
*
* Based on code c. 2009, Tod E. Kurt, http://todbot.com/blog/
*
*/
#include "Wire.h"
extern "C" {
#include "utility/twi.h" // from Wire library, so we can do bus scanning
}
#define TCAADDR 0x70
void tcaselect(uint8_t i) {
if (i > 7) return;
Wire.beginTransmission(TCAADDR);
Wire.write(1 << i);
Wire.endTransmission();
}
// standard Arduino setup()
void setup()
{
while (!Serial);
delay(1000);
Wire.begin();
Serial.begin(115200);
Serial.println("\nTCAScanner ready!");
for (uint8_t t=0; t<8; t++) {
tcaselect(t);
Serial.print("TCA Port #"); Serial.println(t);
for (uint8_t addr = 0; addr<=127; addr++) {
if (addr == TCAADDR) continue;
uint8_t data;
if (! twi_writeTo(addr, &data, 0, 1, 1)) {
Serial.print("Found I2C 0x"); Serial.println(addr,HEX);
}
}
}
Serial.println("\ndone");
}
void loop()
{
}
Code: Select all
#include <Adafruit_ADXL345_U.h>
#include <Wire.h>
#include <Adafruit_Sensor.h>
#define TCAADDR 0x70
/* Assign a unique ID to this sensor at the same time */
Adafruit_ADXL345_Unified mag1 = Adafruit_ADXL345_Unified(1);
Adafruit_ADXL345_Unified mag2 = Adafruit_ADXL345_Unified(2);
void displaySensorDetails(Adafruit_ADXL345_Unified *mag)
{
sensor_t sensor;
mag->getSensor(&sensor);
Serial.println("------------------------------------");
Serial.print ("Sensor: "); Serial.println(sensor.name);
Serial.print ("Driver Ver: "); Serial.println(sensor.version);
Serial.print ("Unique ID: "); Serial.println(sensor.sensor_id);
Serial.print ("Max Value: "); Serial.print(sensor.max_value); Serial.println(" uT");
Serial.print ("Min Value: "); Serial.print(sensor.min_value); Serial.println(" uT");
Serial.print ("Resolution: "); Serial.print(sensor.resolution); Serial.println(" uT");
Serial.println("------------------------------------");
Serial.println("");
delay(500);
}
void tcaselect(uint8_t i) {
if (i > 7) return;
Wire.beginTransmission(TCAADDR);
Wire.write(1 << i);
Wire.endTransmission();
}
void setup(void)
{
Serial.begin(9600);
Serial.println("HMC5883 Magnetometer Test"); Serial.println("");
/* Initialise the 1st sensor */
tcaselect(2);
if(!mag1.begin())
{
/* There was a problem detecting the HMC5883 ... check your connections */
Serial.println("Ooops, no HMC5883 detected ... Check your wiring!");
while(1);
}
/* Initialise the 2nd sensor */
tcaselect(4);
if(!mag2.begin())
{
/* There was a problem detecting the HMC5883 ... check your connections */
Serial.println("Ooops, no HMC5883 detected ... Check your wiring!");
while(1);
}
/* Display some basic information on this sensor */
tcaselect(2);
displaySensorDetails(&mag1);
tcaselect(4);
displaySensorDetails(&mag2);
}
void loop(void)
{
/* Get a new sensor event */
sensors_event_t event;
tcaselect(2);
mag1.getEvent(&event);
/* Display the results (magnetic vector values are in micro-Tesla (uT)) */
Serial.print("Sensor #1 - ");
Serial.print("X: "); Serial.print(event.magnetic.x); Serial.print(" ");
Serial.print("Y: "); Serial.print(event.magnetic.y); Serial.print(" ");
Serial.print("Z: "); Serial.print(event.magnetic.z); Serial.print(" ");Serial.println("uT");
tcaselect(4);
mag2.getEvent(&event);
/* Display the results (magnetic vector values are in micro-Tesla (uT)) */
Serial.print("Sensor #2 - ");
Serial.print("X: "); Serial.print(event.magnetic.x); Serial.print(" ");
Serial.print("Y: "); Serial.print(event.magnetic.y); Serial.print(" ");
Serial.print("Z: "); Serial.print(event.magnetic.z); Serial.print(" ");Serial.println("uT");
delay(500);
}
- Attachments
-
- a1.jpg (158.55 KiB) Viewed 270 times
- yujundimo
- Posts: 4
- Joined: Fri Apr 20, 2018 8:32 am
- adafruit_support_bill
- Posts: 88093
- Joined: Sat Feb 07, 2009 10:11 am
Re: ADXL345 and TCA9548A
None of those boards are Adafruit boards. You should contact the seller or manufacturer for technical support.
- yujundimo
- Posts: 4
- Joined: Fri Apr 20, 2018 8:32 am
Re: ADXL345 and TCA9548A
i got these as a gift and material to use , i have no idea who is the manufactor or the seller , could you please help me out :((
- adafruit_support_bill
- Posts: 88093
- Joined: Sat Feb 07, 2009 10:11 am
Re: ADXL345 and TCA9548A
They appear to be connected correctly and responding as confirmed by the scanner code. But we cannot guarantee that our ADXL345 library will work with anything other than the boards it was designed for.
Please be positive and constructive with your questions and comments.