## Physics Lab: The Rotary Encoder

When I started thinking about the G-Force machine I knew that I wanted to be able teach Newtons Laws using data collected from the machine.  That meant that I needed position, velocity and acceleration.  Since we all went to Physics class, we remember that you can calculate velocity from the change in position, and you can calculate acceleration from the change in velocity.

Given all of that, I decided to start with an E6A2-CW3C rotary quadrature encoder which I bought from Sparkfun.  This device sends out two trains of pulses based on the direction and speed of the rotor.  There is/will be a wheel attached to the rotor of this device that will run along the track.  As the car moves, it will turn the rotor and send out the train of pulses which can then be connected the PSoC TCPWM which is a block inside of the PSoC.   These pulses are encoded with a scheme known as “quadrature encoding”.

The next picture is a snapshot from the Cypress Quadrature Decoder Component Datasheet which explains quadrature.

The E6A2-CW3C quadrature decoder generates 200 pulses per rotation.  Assuming that the diameter of the wheel that I attach to the device is 10″, I will be able to measure a change of 10″/200 pulses = 0.05 inch.  More than enough.  In fact the PSoC Quadrature component is capable of counting rising and falling edges which yields a multiplier up to 4x or 0.0126″ (which is beyond ridiculous).  The one issue that is important with the design is that I would like the total number of pulses that the system generates as it moves down the track to be able to fit into a 16-bit number.  Given that the track is 120′ long, that means with a 10″ wheel I will get 120 feet*12 inches/foot / 10inches/turn = 144 turns * 200 pulses/turn = 28,800 pulses for the entire length of the track.  This is good as it is well less than 2^16=65536 which is the largest number that can fit into a 16-bit number.

In the next post Ill talk more about the Accelerometer(s).

Index Description
Physics Lab: An Introduction to G-Force Introduction
Physics Lab: The Rotary Encoder Measuring position

## Physics Lab: An Introduction to G-Force

My friend Bill Cloyd runs a non-profit company in Lexington, Kentucky called Newtons Attic.   The company focuses on Engineering and Physics education for kids.  Billy runs day camps, week camps and after school camps for primary school kids.  In these camps/classes the kids build robots, catapults, cross-bows, Rube Goldberg machines, fly drones etc. uising the tools in the machine shop at the Newtons Attic Campus.  This is the perfect place for budding engineers and scientists.  In addition to this he does road shows with his crazy machines.

One of the machines (called G-Force) is 120′ long track with a spring activated car.   One end of the track curves up to the sky.  This is an excellent platform for teaching kids about Newtons Laws.  Here are a couple of pictures:

When high-school physics classes visit Newtons Attic they take “data” using stop watches etc and then try to match their observations to the predictions that result from Newtons Law.  I always felt that this process would greatly benefit from some automation.   I have launched into a project to build an electronic system that can attach to the car and collect and transmit the kinematic data from the car.  For those of you who have forgotten kinematic data is position, velocity and acceleration.

To do this I am building a system around the new Cypress PSoC4-BLE chip.  The system will have the following “sensors”

1. A Linear Encoder attached to a wheel running along the track

2. A 3-Axis Accelerometer

3. A 3-Axis Gyro

4. A 3-Axir Magnetometer

5. A Spansion (now Cypress) SPI Flash to record the data

6. An Air Pressure Sensor and a Relative Humidity Sensor (which I will use to calculate the Air Density)

The PSoC4-BLE will collect the data from these sensor and broadcast the data to any BLE Enabled device (iPhone, Android Phone).

The last part of the system will be a Swift App (running on iPhone) and a Java App (running on Android) to collect and display the data.

In the next bunch of posts you will be able to follow me through the Schematic Design, Board Design, Firmware Development, Board Manufacturing and App development process.

Alan

Index Description
Physics Lab: An Introduction to G-Force Introduction
Physics Lab: The Rotary Encoder Measuring position