Knee Brace Project planted with 6 Accelerometers and BBB

Hello, I’m working on a college project and my task is to develop a software code for a knee brace, that has 6 accelerometers planted on the frame (4 Analog Accelerometers and 2 Digital Accelerometers). The Analog accelerometers have 3 axis of dimensions, X, Y, & Z, whereas the Digital accelerometers have two interrupts (INT0 and INT1), an SDA, an SCL, a 3.3V ref and a GND. I need to program the BBB to turn on the designated pins on the expansion slots for the ref voltage (P8 & P9 respectively), and for the reading of the accelerometers on the computer screen. After that I need to store the data from the accelerometers to an SD card. The main issue for this is that I’m not very good at programming, especially for the BBB since I haven’t worked on it before, so is there any examples or tutorials on how I can make the software code from scratch or by putting different kinds of code together to make it work? Or is there any one who knows how to turn on any pin on the BBB and read the accelerometers from the expansion slots? I appreciate anyone who helps me out on this as it is a challenging step for me in. Any advice is appreciated,

Thank you!

A note to all those who see this post: please do not be overwhelmed by the project! it really is not that complicated when you think about it. Its just a regular knee brace with acccelerometers planted on it. I just need help on how to make a python code for reading the accelerometers on the gpio pins as well as the ADC pins. They behave like sensors. The Analog accelerometers have 3 connectors for the X, Y and Z dimension respectively and I’m looking for a way to make a code for reading those 3 dimensions in python. Any help is appreciated.

Maybe this will help some. I am not a big python guy so dont have code to share. Why did you choose python over other languages?

And one more I found

Well I was thinking of choosing python because of its ease of use for pin manipulation and when I first got the beaglebone, I was setting up the python library. I wasn’t sure how to do it in other languages because I don’t have that much experience. As far as C++ is concerned, I do know a little bit of it from college, but haven’t continued learning it.

If they’re analog, surely you’d just hook them up to the analog pins and read them the normal way? Probably with a couple of resistors to reduce the voltage range to 1.8V?

Out of curiousity is there a reason you’re using analog accelerometers? I’m far from a pro but I2C based ones like the ADXL345 are incredibly easy to use - two slave addresses possible, you have 2 I2C busses so that’s 4 you can access - mix in a couple of other models (eg MMA7660) or hook them up via an I2C multiplexer and you can use 6. Digital is so much easier to work with, not least when it comes to running the wires - 4 (3V3, SCL, SDA, GND) is better than 4x3=12 for your analogs plus your 4 I2C wires for the others.

Your right, I can hook up the analog sensors to the analog pins and read them the normal way. The reason for analog is because when i was assigned this project, it was already made by other teams who worked on it 2 years ago. It’s an R/D project from the college, but they haven’t provided any info on it from those days, except mentioning that the brace works and the sensors are operational. I only had to order the BBB and make a program for it to read those sensors in real time. I chose Python for the sake of simplicity and i just learned how to make use of the board from it. Its no problem for those asking out of curiosity, questions are welcome.
Now since there are 7 ADC pins on it, I have 12 wires for the Analog sensors, each of them with X, Y and Z axis. I’m not sure how I can fit all of them on the ADC. Is there a way I can use the GPIO pins for any extra wires left over? if so, then how can i make use of them? in a loop, or a if statement?

Hello Zain, I’m no help on the coding, but would like to answer your question on resources for learning more about BeagleBone Black.
Best place to start is the getting started link. Plug in your board first to see the tutorials.
Both of these books are available via ebook download for low cost: Bad to the Bone: Crafting Electronic Systems with BeagleBone and BeagleBone Black
Getting Started with BeagleBone
the second book does more with python.

in addition there are online resources from Prof Yoder MPU Sitara BeagleboardXM: 32-Bit Embedded Linux Course
and Prof Molloy Derek Molloy’s video series on the Beaglebone and programming in embedded Linux


Thanks Cathy for the help, I have been using the beaglebone getting started link and have been trying out the examples, they have been a great help with the tutorials. As for the ebooks, il think about it, but thanks for referring them to me. Prof. Molloy’s tutorials have also been helpful, I’ll take a look at Prof Yoder’s tutorials. Overall, thanks again for helping.

Nice of the other team to leave you no documentation…

I guess if I was stuck with 12 analog inputs and only 7 pins to read them on I would use something like a 74HC4051 to multiplex the inputs - use 3 gpio pins to control which of the 8 inputs is connected to the ADC on the BBB. Or use an MCP3426 (or similar) - a 4-channel ADC that you can talk to over I2C. Either way I think if you want to get 12 into 7, you’re going to need another chip.

I know, I felt really annoyed that the Prof who provided the brace was not so keen on how it was tested… yet provide at least a history report on it.
If the inputs of analog sensors require an extra chip, then I will need to look around for the chips mentioned in the previous post. Thanks alot for helping me out! I’ll see what happens next.

If you’re looking for something quick & easy, try Sparkfun’s Analog/Digital MUX Breakout at . I haven’t used it myself but it looks like something that could get you going quickly. Just don’t forget the BBB’s analog input voltage limit of 1.8v.!

Hi Seth! Thanks for the help, this will be a great part for the analog inputs!

Oh yeah I also have another question: is it possible to create a waveform display of the analog sensors through python? Since I have the idea for reading voltages, I was wondering if its possible to create a sort of waveform with the x y and z axis. For that I think there should be a separate program for it or if i can combine it with the ADC setup.

A quick question @Mike Bremford: since I have a code for reading the voltages from the accelerometers, is there a way to create the waveforms in python? I was just wondering if its possible to make a waveform, but i think that will be another program code for it. I’m just not sure how to do it.

I’m a candidate for your Knee Brace…so I am interested


Hi Tom! thanks for the interest in my project! Do you have any experience with python and accelerometers?

Quick Question @Mike Bremford: Do you know how the digital accelerometers will be reading on the beaglebone black’s I2C pins? I haven’t had much luck finding any examples for a program code.

some with python, only strain guages …which accelerometers are you thinking about?

Well, I have 4 analog accelerometers (Sparkfun MMA7361L) and 2 digital (Sparkfun ADXL345).