Skip to content

Conversation

@Kletternaut
Copy link

Extended version of Matthias Wandel AS5600 example code:
https://github.com/Matthias-Wandel/AS5600-Raspberry-Pi-Python/blob/master/as5600.py

This extended version is for use with TCA9548A multiple(xer) AS5600 encoders
https://www.ti.com/lit/ds/symlink/tca9548a.pdf
https://www.mouser.com/pdfdocs/AMS_AS5600_Datasheet_EN.PDF

Usage: python3 as5600_tca9548a.py or empty
No given argument will disable TCA9548A switching and read from 0x36 directly
channel is a number from 0 to 7, which will select the TCA9548A channel

Very simple code to read AS5600 magnetic encoder with Python
on raspberry pi

Requires Python smbus module. Get it using:
sudo apt-get install python3-smbus

Make sure Pi's I2c is enabled using
sudo raspi-config

Connect Pi's ground to GND and DIR pins
Connect Pi's 3.3 volts to VCC on AS5600
Connect Pi's I2c SCL (pin 5) to AS5600 SCL pin
Connect Pi's I2c SDA (pin 5) to AS5600 SDA pin

Watchout: use a level shifter if you are using 5V AS5600

bash commands:

read i2c-bus: sudo i2cdetect -y 1
set TCA9548A switching off: sudo i2cset -y 1 0x70 0x00

set TCA9548A channel-0: sudo i2cset -y 1 0x70 0x01
set TCA9548A channel-1: sudo i2cset -y 1 0x70 0x02

read AS5600 raw angle: sudo i2cget -y 1 0x36 0x0C
read AS5600 magnitude: sudo i2cget -y 1 0x36 0x1B

# Extended version of Matthias Wandel AS5600 example code:
# https://github.com/Matthias-Wandel/AS5600-Raspberry-Pi-Python/blob/master/as5600.py
#
# This extended version is for use with TCA9548A multiple(xer) AS5600 encoders
# https://www.ti.com/lit/ds/symlink/tca9548a.pdf
# https://www.mouser.com/pdfdocs/AMS_AS5600_Datasheet_EN.PDF
#
# Usage: python3 as5600_tca9548a.py <channel> or empty
# No given argument will disable TCA9548A switching and read from 0x36 directly
# channel is a number from 0 to 7, which will select the TCA9548A channel
#
# Very simple code to read AS5600 magnetic encoder with Python
# on raspberry pi
#
# Requires Python smbus module.  Get it using:
#     sudo apt-get install python3-smbus
#
# Make sure Pi's I2c is enabled using
#     sudo raspi-config
#
# Connect Pi's ground to GND and DIR pins
# Connect Pi's 3.3 volts to VCC on AS5600
# Connect Pi's I2c SCL (pin 5) to AS5600 SCL pin
# Connect Pi's I2c SDA (pin 5) to AS5600 SDA pin
#
# Watchout: use a level shifter if you are using 5V AS5600
# ======================================================================
# bash commands:
#
# read i2c-bus:                sudo i2cdetect -y 1
# set TCA9548A switching off:  sudo i2cset -y 1 0x70 0x00
#
# set TCA9548A channel-0:      sudo i2cset -y 1 0x70 0x01
# set TCA9548A channel-1:      sudo i2cset -y 1 0x70 0x02
#
# read AS5600 raw angle:       sudo i2cget -y 1 0x36 0x0C
# read AS5600 magnitude:       sudo i2cget -y 1 0x36 0x1B
 Extended version of Matthias Wandel AS5600 example code:
 https://github.com/Matthias-Wandel/AS5600-Raspberry-Pi-Python/blob/master/as5600.py

 This extended version is for use with TCA9548A multiple(xer) AS5600 encoders
 https://www.ti.com/lit/ds/symlink/tca9548a.pdf
 https://www.mouser.com/pdfdocs/AMS_AS5600_Datasheet_EN.PDF

 Usage: python3 as5600_tca9548a.py <channel> or empty
 No given argument will disable TCA9548A switching and read from 0x36 directly
 channel is a number from 0 to 7, which will select the TCA9548A channel

 Very simple code to read AS5600 magnetic encoder with Python
 on raspberry pi

 Requires Python smbus module.  Get it using:
     sudo apt-get install python3-smbus

 Make sure Pi's I2c is enabled using
     sudo raspi-config

 Connect Pi's ground to GND and DIR pins
 Connect Pi's 3.3 volts to VCC on AS5600
 Connect Pi's I2c SCL (pin 5) to AS5600 SCL pin
 Connect Pi's I2c SDA (pin 5) to AS5600 SDA pin

 Watchout: use a level shifter if you are using 5V AS5600
 ======================================================================
 bash commands:

 read i2c-bus:                sudo i2cdetect -y 1
 set TCA9548A switching off:  sudo i2cset -y 1 0x70 0x00

 set TCA9548A channel-0:      sudo i2cset -y 1 0x70 0x01
 set TCA9548A channel-1:      sudo i2cset -y 1 0x70 0x02

 read AS5600 raw angle:       sudo i2cget -y 1 0x36 0x0C
 read AS5600 magnitude:       sudo i2cget -y 1 0x36 0x1B
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant