Bicycle-Mounted
Road Quality Sensor

MAS.836 Final Project

Caroline Jaffe

May 2016

Background & Motivation

  • Data on bicycles is extremely sparse (e.g. state of the art is bike counter)
  • Better data can help cities/ advocacy groups make better choices
  • Way to leverage public resource to learn more about city (e.g. better sensors on Hubway)

Design

  • Accelerometer and piezo films on the handlebars
  • Chip selection and general design
  • Power considerations
  • Communications and data

Design: Piezo Circuit

  • Non-inverting amplifier & peak detector

Design: Piezo Circuit

  • Tested to see output range (0 - .75 V), and choose R's to scale to 0 - 3.3 V (R1 = 2.87 kOhms, R2 = 10 kOhms for A = 4.4)
  • Found frequency and appropriate peak detector values (C = 10 uF, R = 6.34 kOhms)
  • Noted that piezos should be close to amplifier

Design: PCBs

  • Regulated power source
  • Accelerometer
  • LEDs for debugging
  • SPI programming header
  • Peak detectors & non-inverting amps (separate)
  • Serial interface

Embedded Programming: Piezos


void setADC1(){
      ADMUX = (0 << REFS1) | (0 << REFS0) // Vcc ref
         | (0 << MUX5) | (0 << MUX4) | (0 << MUX3) | (0 << MUX2) | (0 << MUX1) | (0 << MUX0); // ADC0
}

void setADC2(){
      ADMUX = (0 << REFS1) | (0 << REFS0) // Vcc ref
         | (0 << MUX5) | (0 << MUX4) | (0 << MUX3) | (0 << MUX2) | (0 << MUX1) | (1 << MUX0); // ADC1
}
					

Originally using Arduino IDE......ran into some space issues!

Embedded Programming: Piezos

Embedded Programming: Accelerometer


ret = I2C_master_write(data,1,I2C_slave_address);
ret = I2C_master_read(data,6,I2C_slave_address);
put_char(&serial_port,serial_pin_out,data[0]);
put_char(&serial_port,serial_pin_out,data[1]);
put_char(&serial_port,serial_pin_out,data[2]);
put_char(&serial_port,serial_pin_out,data[3]);
put_char(&serial_port,serial_pin_out,data[4]);
put_char(&serial_port,serial_pin_out,data[5]);
					
  • Also originally used Arduino IDE, switched to using straight C, bit-banging implementation of I2C via Neil
  • Accelerometer is I2C "slave", Attiny44 as I2C "master" reads 2 bytes of acceleration data for each axis
  • Sends high and low bit over serial

Embedded Programming: Accelerometer

Programming: Communications

  • Sensor sends data over BLE using HM-10 module
  • Allow computer to read from BLE using a variety of node modules (noble, virtual serial-port, serial-to-socketio)
  • Front-end: further processing and visualization
  • Advantages and disadvantages

Programming: Front End

  • JS, Jquery & D3
  • Streaming data, not saving data*
  • See actual data, but also a visual indicator based on color of circles
  • Basic quality and detection logic
  • See it in action...

*N.B. Added download data functionality to see snapshot of the data

Sensors in Action!

Sensors in Action!

Sensor Data

Piezo1 data from Bumpy vs Smooth Road

each time division ~ 50 ms

Sensor Data

Piezo2 data from Bumpy vs Smooth Road

each time division ~ 50 ms

Live Demo*

*only try this if you are running the app.js file locally, within range of the sensor, etc!

Challenges, Lessons
& Next Steps?

  • Integration is hard
  • Careful systems thinking and design is important

  • Make it more mobile - use an app!
  • Integrate GPS readings
  • More & better signal processing and detection logic
  • Better integration into the bicycle
  • Data storage & longer-term analysis

Thanks!

cjaffe@media.mit.edu

See project files on Github