FeatherS2 accelsensor example code not working

For Adafruit customers who seek help with microcontrollers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
andrewvd01
 
Posts: 5
Joined: Sat Jan 28, 2023 2:29 pm

FeatherS2 accelsensor example code not working

Post by andrewvd01 »

Hello,

I recently purchased a ESP32 FeatherS2 and a LMS303AGR for a capstone project in school. I followed the adafruit tutorials and datasheet to wire and test the LMS303AGR for the accelerometer but it gives no output. When I try the code with an Arduino Mega, it works perfectly. I have no problems running other code in FeatherS2. I need to use the accelerometer with the FeatherS2 because my project requires that I have a small enough device be portable with a battery. The example code I use for the LMS303AGR (which is found in the LMS303AGR datasheet as well) is Examples -> Adafruit LMS303 Accel -> accelsensor. If you could help me with this issue I would greatly appreciate it.

Thanks,

Andrew

User avatar
dastels
 
Posts: 15608
Joined: Tue Oct 20, 2015 3:22 pm

Re: FeatherS2 accelsensor example code not working

Post by dastels »

Are your connections good? Are you using the STEMMA-QT connection or soldered? Which ESP32-S2 Feather are you using?

Dave

User avatar
andrewvd01
 
Posts: 5
Joined: Sat Jan 28, 2023 2:29 pm

Re: FeatherS2 accelsensor example code not working

Post by andrewvd01 »

My connections are good. I tried different wires and a different breadboard. I tried both STEMMA and jumper wire connections. Those same connections worked on the Arduino Mega. I am using the ESP32-S2 FeatherS2. I couldnt find anything else that says what its called. I am not sure what the problem is with it. I can get the serial monitor to print using other code. Ive also tried editing code and got the serial monitor running but showed all 0's for output values.

User avatar
dastels
 
Posts: 15608
Joined: Tue Oct 20, 2015 3:22 pm

Re: FeatherS2 accelsensor example code not working

Post by dastels »

This is the board? https://www.adafruit.com/product/4769

What do you see if you run anI2C scan? See https://learn.adafruit.com/scanning-i2c-addresses

Dave

User avatar
andrewvd01
 
Posts: 5
Joined: Sat Jan 28, 2023 2:29 pm

Re: FeatherS2 accelsensor example code not working

Post by andrewvd01 »

That is the correct board. When I run the I2C scan there is nothing on the output.

If I run the blink program and add a serial output, it posts in the serial monitor. This is why I am confused as to what the problem could be.

To add more information, the sensor is powered up when it is plugged in and I have tried multiple connections.

User avatar
dastels
 
Posts: 15608
Joined: Tue Oct 20, 2015 3:22 pm

Re: FeatherS2 accelsensor example code not working

Post by dastels »

Since you compare to a Mega, I'm assuming you're using C++/Arduino?

Can you post the output of the I2C scan?

Do you have another I2C sensor you could test with?

Dave

User avatar
andrewvd01
 
Posts: 5
Joined: Sat Jan 28, 2023 2:29 pm

Re: FeatherS2 accelsensor example code not working

Post by andrewvd01 »

Output screenshot attached. I am using the arduino IDE. I do not have any other I2C sensors to test with.
Attachments
Capture.PNG
Capture.PNG (53.76 KiB) Viewed 160 times

User avatar
dastels
 
Posts: 15608
Joined: Tue Oct 20, 2015 3:22 pm

Re: FeatherS2 accelsensor example code not working

Post by dastels »

OK, the "on" LED above the left-hand STEMMA connector is lit?

I would use the STEMMA cables as they are more direct and with fewer connections.

Can you try with CircuitPython? That would give another datapoint.

Meanwhile I'll see if anyone in support has seen this issue before.

Dave

User avatar
adafruit_support_carter
 
Posts: 29056
Joined: Tue Nov 29, 2016 2:45 pm

Re: FeatherS2 accelsensor example code not working

Post by adafruit_support_carter »

Please double check and verify which specific Feather you are using.

The PID 4769 Feather is from Unexpected Maker:
https://www.adafruit.com/product/4769
and is not the same as the Adafruit Feather ESP32 being selected in the Arduino IDE:

board.jpg
board.jpg (23.4 KiB) Viewed 155 times

The correct board must be select in the Arduino IDE.

User avatar
andrewvd01
 
Posts: 5
Joined: Sat Jan 28, 2023 2:29 pm

Re: FeatherS2 accelsensor example code not working

Post by andrewvd01 »

Thank you for the help. The issue was that the correct device was not selected. Thank you for pointing that out. I was unaware there was a difference between the Adafruit ESP32-S2 Feather and the UM FeatherS2 so I had picked the first one without even knowing there was the other option. The sensor now works properly.

Thanks,

Andrew

User avatar
adafruit_support_carter
 
Posts: 29056
Joined: Tue Nov 29, 2016 2:45 pm

Re: FeatherS2 accelsensor example code not working

Post by adafruit_support_carter »

Cool. Glad it was that easy and it resolved things. It's a common issue and definitely confusing, esp. with the ESP32 based boards - there are tons with similar sounding names. Good luck with the school project!

Locked
Please be positive and constructive with your questions and comments.

Return to “Microcontrollers”