Some code for monitoring an accelerometer through a collision.
  • C++ 68.7%
  • Python 20.5%
  • Makefile 10.8%
Find a file
2013-03-16 17:01:11 -05:00
maple-mini maple-mini: better commenting of wire protocol 2013-03-16 17:01:11 -05:00
view viewer: some renaming to better reflect change in rfcomm semantics related to use of 'bind' 2013-03-16 15:41:03 -05:00
.gitignore minor tree reorganization 2013-03-04 22:29:10 -06:00
README.md provide some battery documentation 2013-03-16 15:27:10 -05:00

This is code which drives a microcontroller assembly for collecting accelerometer readings during a collision event. The hardware is composed of:

  1. A LeafLabs Maple Mini board, featuring an STM32 microcontroller

  2. An Analog Devices ADXL377 high-g three-axis accelerometer, wired to STM32 analog inputs

  3. A Roving Networks RN42 bluetooth module, wired to USART3 on the STM32 and used for transmitting accelerometer data for display on a remote workstation

Directory maple-mini contains firmware for the STM32. The libmaple repository must be checked out as a dependency.

Directory view contains Python code for downloading accelerometer data to a Linux PC over the bluetooth link.

POOR MAN'S SCHEMATIC

I'm too lazy to draw up a schematic for this, but here are the connections. Maple Mini pin numbers are the numbers written on the PCB, not the standard pin numbers associated with the 40-pin package.

Maple Mini Power:

  • Batteries hooked up between VIN and GND pins, in range 3.3V to 12V

Maple Mini to RN42XV:

  • MM pin VCC to RN pin 1 (VDD_3V3)
  • MM pin GND to RN pin 10 (GND)
  • MM pin 0 (USART3_RX) to RN pin 2 (TXD)
  • MM pin 1 (USART3_TX) to RN pin 3 (RXD)
  • MM pin 30 (SPI2_SCK/USART3_CTS) to RN pin 12 (RTS)
  • MM pin 29 (SPI2_MISO/USART3_RTS) to RN pin 16 (CTS)
  • MM pin 28 (SPI2_MOSI) to RN pin 5 (RESET_N)
  • MM pin 27 (PWM/USART1_CK) to RN pin 13 (GPIO2, connection status)

Maple Mini to ADXL377 evaluation board:

  • MM pin AV+ to ADXL pin 2 (VS)
  • MM pin AV- to ADXL pin 6 (GND)
  • MM pin 11 (ADC_IN0) to ADXL pin 3 (X_OUT)
  • MM pin 10 (ADC_IN1) to ADXL pin 4 (Y_OUT)
  • MM pin 9 (ADC_IN2) to ADXL pin 5 (Z_OUT)

ADDITIONAL HARDWARE NOTES

Plan for about 80mA peak current draw (which happens when the RN42 is turned on). I used a 160mAh lithium polymer battery; this works well due to the high discharge rate, very small volume, and nearly ideal voltage (3.7V is a good match to the 3.3V LDO regulator provided on the Maple Mini).

LICENSE

Copyright (c) 2013 Paul Pelzl
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.