AMS AS5048B I2c Adapter board I2C Erro

Hello all, I hope you are all well and holding it together.

I'm having some problems with using a AMS 5048B rotary magnetic sensor.

https://ams.com/as5048badapterboard

I've got a couple of the evaluation adapter boards and have installed the library from SOS android.

I'm not sure where I'm going wrong but I am having problems getting consistent results with the sensor.

I've tried with a D1 r2 and with a Teensy 4.1 but get the same results.

I've checked and rechecked my wiring and can't find any problems

I'm not sure if I have a hardware or software problem.

I have tried the read_simple_angle example included with the library without making any changes to the code and have connected the AMS board like so:
AMS Board..............................D1....................................Teensy 4.1
5v..............................................5v....................................3.3V
Gnd........................................Gnd...................................Gnd
SCL.........................................D15/GPIO5 (SCL) .............PIN19 (SCL)
SDA........................................D14/GPIO4(SDA)..............PIN 18(SDA)
(This was a lovely table when I wrote the post - and when I edited it- but the forum has altered the formatting soz)

When I open up the serial monitor I get similar results on the D1 and on the Teensy:

Something like this:

Angle degree : 180.9667968750

Angle degree : 180.8789062500

Angle degree : 180.8789062500

Angle degree : I2C error: 2

359.9780273438

Angle degree : I2C error: 2

359.9780273438

Angle degree : I2C error: 2

359.9780273438

Angle degree : 180.9887695312

Angle degree : 180.9008789062

Angle degree : 180.9448242187

Angle degree : 180.9667968750

Can someone give me a bit of a steer as to what the I2C error is all about? and what steps I coudl take to resolve it? I'm just learning about I2C through using these sensors so would very much appreciate a bit of guidance. Longer term I am hoping to use multiple 5048 sensors simultaneously but I definitely need to be able to crawl before I can stumble :slight_smile:

Many thanks

Dave

Thanks in advance

I'm missing the links to the hardware used, the library used and a wiring diagram. A photo of the complete setup may help too. Also post the exact code you're using (except you're using the example code without changing a single byte).

I have added the link to the AMS website to my original post

The code I am using is the example that is included with the library:

Read-simple-angle

Here is a link to the library:

Thank you for reading.

THIS SETUP DOESN'T WORK

Here is a circuit diagram of my current setup.

It was unclear as to whether pull up or pull down resistors are required and I'm guessing this could be the issue... If so value(s) and location(s) would be a great help

I wasn't able to find a forum post or arduino tutorial anywhere online with a wiring diagram or find any documentation of anyone who has succeeded in using this board... I could only find people posting on the forum with problems but no documented solutions.

That's why I thought I might ask for a little help as I'm guessing other people may be having similar issues... (and I promise to let others know what works when I solve my problem!)

Thanks all x

The microcontroller shown in this circuit diagram is a Wemos D1 very. 2015-08

I get what appear to be identical results when substituting a teensy 4.1 and using the same code and circuit

Unfortunately the documentation of the adapter board doesn't handle the I2C case and it doesn't provide schematics of the board. Try to measure with a DMM if there is a pull-up from SDA to 3.3V.

In my interpretation of the datasheet you must connect the A1 and A2 pins to either 3.3V or GND, floating pins (no connection) doesn't seem to be supported. In your case the must be connected to GND (both).

Thanks Pylon This now appears to be working perfectly.

As suggested I have connected The A1 and A2 (MOSI, MISO) pins of the AS5048B board to GND on the teensy and this appears to have resolved the problem.

For anyone else scratching their head with this here is the wiring diagram that worked for me, it should work for all other Arduino based boards with whichever native SCL and SDA pins used,

I've just tried this with a Wemos D1 R2 and it works with SCL and SDA pin used as D15 and D14 respectively and it's working perfectly.

Thanks again Pylon and I hope this helps someone else

Cheers All!

Edit: Image updated to show 3.3V for Teensy 4.1

As an addendum to this thread. I found that when using multiple AS5048B boards on the same i2c bus that adding a 4.7k pull up resistor between 5v pin and Scl pin along with a 4.7k pull up resistor between 5v and sda seemed to make all my problems go away.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.