-
Notifications
You must be signed in to change notification settings - Fork 21
Encoders
##Hardware Our PiCar uses two quadrature encoders to calculate position and velocity. It uses 400P/R Rotary Encoder 6mm Incremental Optical Shaft Working Measurement 5-24V US.
Features:
- 400 pulses per revolution (Single-phase 400 pulses /R,Two phase 4 frequency doubling to 1600 pulses)
- Power source: DC5-24V
- Output: AB 2phase output rectangular orthogonal pulse circuit, the output for the NPN open collecter output type
- Shaft: 613mm/0.230.51"
- Size: 3835.5mm/1.491.39"
- Maximum mechanical speed: 5000 R / min
- Response frequency: 0-20KHz
- Cable length: 1.5 meter
- Added 1 K pull-up resistors on the PCB/Breadboard
Note: AB 2phase output must not be directly connected with VCC, otherwise, will burn the output triode Because different batches, and may not have the terminal
##Software Implemented using code that hrvoje shared on the raspberry pi website as a foundation. Link to forum
###IMU Object Class The encoder program uses rotary interrupts to count the incremental rotations for the position. Whenever it senses an interrupt, it increments the count. In the sample() method, the encoders test for:
- position (m)
- velocity (m/s)
###Testing programs
- main_sensors.py - samples the encoders and IMU at a specified frequency and aggregates the data (see the Client Data Scheduler for more information)
- main_all.py - samples encoders, IMU, and Motive Camera Data at a specified frequency, aggregates data, and pushes to basic web server (see the Client Data Scheduler for more information)
###How to test:
- Connect the encoders to these GPIO pins:
- Right encoder pins: 19, 26
- Left encoder pins: 6, 13
- Run main_sensors.py or main_all.py
- View data in encR-simul-results.txt or encL-simul-results.txt for right and left encoder data.
- If testing with main_all.py, view data refreshing on localhost.
##Credits Code written and tested by: Reese Frerichs and Kristen Koyanagi