Because each segment of the leg needs two axis accelerometer, it means there is the need for:
12 servo motors
each servo needs two axis to get the position (rotation)
so: 12 leg segmenst * 2 channels each accelerometer = 24 analog input ADC is required.
A good option is this stackable ADC, with 8 channels each board:
https://www.abelectronics.co.uk/p/69/adc-pi-raspberry-pi-analogue-to-digital-converter
Each of these has 2 ADC chips of type MCP3424
That seems to be supported by Pi4j:
https://github.com/Pi4J/pi4j/blob/master/pi4j-example/src/main/java/MCP23017GpioExample.java Up to 4:
can be connected using these I2C addresses:
0x68
0x69
0x6A
0x6B
0x6C
0x6D
0x6E
0x6F
Each board will take two addresses as each board has two chip. Way to setup the I2C address is this:
Board features (copied from the AB electronics page):
8 x 17-bit 0 to 5V Single Ended Inputs
Control via the Raspberry Pi I2C port
Stack up to 4 ADC Pi boards on a single Raspberry Pi
Jumper selectable I2C addresses
Buffered 5V I2C port
Based on the MCP3424 from Microchip Technologies Inc
Single Ended full-scale range of 5.0V
On-board 2.048V reference voltage (Accuracy ± 0.05%, Drift: 15 ppm/°C)
On-Board Programmable Gain Amplifier (PGA): Gains of 1, 2, 4 or 8
Programmable Data Rate Options:
- 3.75 SPS (17 bits)
- 15 SPS (15 bits)
- 60 SPS (13 bits)
- 240 SPS (11 bits)
One-Shot or Continuous Conversion Options
The ADC Pi is an 8 channel 17 bit analogue to digital converter designed to work with the Raspberry Pi. The ADC Pi is based on two Microchip MCP3424 A/D converters each containing 4 analogue inputs. The MCP3424 is a delta-sigma A/D converter with low noise differential inputs.
We designed the ADC Pi to work as a single ended A/D converter using the internal 2.048V reference voltage with the -V pins tied to ground. A voltage divider on the ADC Pi board brings the input voltage range to a much more useful 0 – 5.06V. In this configuration the sample size is 17 bits for each channel.
The ADC Pi is powered through the host Raspberry Pi using the GPIO port and extended pins on the GPIO connector allow you to stack the ADC Pi along with other expansion boards.
The two MCP3424 A/D converters communicate via i2c to the host Raspberry Pi giving you eight analogue inputs to use. A logic level converter is included on the ADC Pi board giving you a buffered 5V i2c port making it easy to add other I2C devices which operate at 5 volts without damaging the raspberry pi 3.3 volt i2c port. The i2c buffer uses N-channel mosfets with a maximum drain current of 100mA.
The I2C address bits are selectable using the on-board jumpers. The MCP3424 supports up to 8 different I2C addresses so with two A/D converters on each ADC Pi you can stack up to 4 ADC Pi boards on a single Raspberry Pi giving you 32 ADC inputs.
The MCP3424 contains a programmable Gain Amplifier giving the user a selectable gain of x1, x2, x4 or x8 before the analogue to digital conversion takes place.
The data rate for analogue to digital conversions is 3.75 (17 bit), 15 (15 bit), 60 (13 bit) or 240 (11 bit) samples per second. Data rate and resolution can be configured within software using the I2C interface.
We have a knowledge base article, ADC Sample Rate Comparison which has more detailed sample information and test scripts to compare the different MCP2424 ADC chip bit and sample rates.
Unused inputs should be tied to ground.
To connect the ADC to the ADXL335, I'm using the explanation as shown in the below link:
The circuit will require no extra components because I will use the ADC PI instead of the differential one:
Connect the VCC pin on the ADXL335 board to 3.3V on the GPIO header.
Connect the GND on the ADXL335 to GND on the GPIO header.
Now we need to connect the output from the ADXL335 board to the ADC inputs, as the output from the ADXL335 is up to 3.3 volts we need to add a voltage divider between the ADXL335 output and the ADC Pi positive inputs on each channel. ADC Pi comes with a voltage divide on board, so no need for an extra external one.
Connect the X pin on the ADXL335 to input 1 on the ADC Pi
Connect the Y pin on the ADXL335 to input 2 on the ADC Pi
The Z pin will not be connected, to measure rotation 2 axis will be enough.
Nessun commento:
Posta un commento