Extended version for use with TCA9548A and multiple AS5600#2
Open
Kletternaut wants to merge 3 commits intoMatthias-Wandel:masterfrom
Open
Extended version for use with TCA9548A and multiple AS5600#2Kletternaut wants to merge 3 commits intoMatthias-Wandel:masterfrom
Kletternaut wants to merge 3 commits intoMatthias-Wandel:masterfrom
Conversation
# 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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