Monthly Archives: September 2019

Speaker Amplifier Project, Part VI – Second Production Run

Posted 29 September 2019,

I got an email from Dr. Betty Lise Anderson of the Electrical Engineering Department (I think it’s actually Electrical and Computer Engineering now) at The Ohio State University, asking me if I still had the documentation for the speaker amplifiers I created a couple of years ago for her STEM outreach program.  . Dr. Anderson said these units were very well-liked by her STEM outreach students; so well liked in fact that they apparently walked away on their own!  She asked me if I would be willing to fabricate another couple of amps, and said she would happily pay for all the parts.

Since I never throw anything away, I did indeed have the documentation and even some remaining parts from the original project.  I still had a half-dozen or so of the custom audio level indicator PCBs and at least one Adafruit 20W Class D amplifier left over.  I figured I’d need a couple of wall-wart 12V power supplies and one more amplifier – everything else was already available in my parts bins.  I figured the hundred bucks or so required to get all the parts was not worth worrying about, and besides I could probably write it off as advertising expense for EM Workbench LLC.

The enclosure:

When I made the first set, I 3D printed an enclosure that was a modified version of the nice rounded-corner box design published by Adafruit for just the amplifier.  However, when I tried this trick again, I wound up not liking the result.  Instead, I decided I should be able to create my own rounded corner box.  I searched around on Thingiverse and found a few parameterized rounded box designs, but they all seemed sort of half-baked.  So I broke out my copy of Open SCAD and started figuring out how to do it myself.  I ran across a video that demonstrated the rounded-corner technique using a ‘minkowski’ function, and then I was off and running.  After just a few hours (OK, more than a few, but definitely less than infinity) I had coded a nice, compact Open SCAD module to generate an arbitrary shaped rounded-corner box with an optional companion nesting lid.  The code is available on Thingiverse here.  Using the Open SCAD module, I generated an enclosure and companion lid and exported the result as an STL file, which I then sucked into Tinkercad to add the required cutouts and such for the amplifier project.

Amplifier enclosure as generated in Open SCAD

Amplifier enclosure after importing the STL file into Tinkercad

Amplifier enclosure after modification for the Adafruit amplifier and level indicator PCB

After getting the enclosure design all spiffed up, I started printing it on my trusty PowerSpec 3D Pro 3D printer, only to have it die on me – so much for ‘trusty’!  This was not an entirely unexpected event, as I had been noticing a ‘burnt insulation’ smell coming from it over the last few weeks, and suspected that it might be on its last legs.  So, this batch of amplifier enclosures would have to be single-color (the last one was dual-color red or the enclosure and gray for the text) – at least until my new MakerGear M3-ID 3D printer shows up :-)).  Here’s the result.

Amplifier and Activity Indicator:

In reviewing the documentation from the original project, I saw that the activity indicator schematic wasn’t entirely accurate, so I brought it up to date – mostly cosmetic/lettering, but…

View showing power indicator LED installation before installing power input terminal connector

View showing 2.2K current limiting resistor for power indicator LED

View showing connections between activity monitor PCB and amplifier board

The finished product:

Two complete amplifiers with companion power supplies

A large part of the motivation for this post was to thoroughly document all aspects of fabricating the second run of OSU/STEM speaker amplifiers, so that when I get that next call from Dr. Betty Lise Anderson… 😉

Frank

Sparkfun MPU9250 Test with Teensy 3.2

Posted 15 September 2019

After successfully demonstrating heading-based wall following with my little two motor robot, I attempted to integrate this capability back into my newly re-engined (re-motored??) 4-wheel Wall-E2 robot. Naturally the attempt was a dismal failure, for reasons I have yet to determine.  For some reason, the MPU 6050 IMU on the 4-wheel robot refused to produce valid heading data, and when I then attempted to redo the previously successful experiment on my 2-wheel robot, it too failed – in the same manner!  Clearly the two robots got together and decided to misbehave just to watch me tear what’s left of my hair out!

So, after trying in vain to figure out WTF with respect to the two robots and their respective IMU’s, I decided to just start all over with a different controller and a different IMU and see if I could just make something positive happen.  I found a Sparkfun MPU 9250 IMU breakout board in my parts bin, left over from an older post.  Because the Sparkfun board is set up for 3.3V only, I decided to use a Teensy controller instead of an Arduino Mega and see if I could just get something to work.

After the usual number of screwups and frustrations, I was finally able to get the Sparkfun MPU 9250 breakout board and the Teensy 3.2 talking to each other and to capture some valid heading (yaw) data from the MPU 9250.  The reason for this post is to document the setup and the code so when I have this same problem a year from now, I can come back here and have a working, documented baseline to start with.

The Hardware:

I used a Teensy 3.2 and a Sparkfun MPU 9250 IMU breakout board, both mounted on a small ASP solderless breadboard, as shown in the following photo, along with a Fritzing view of the layout

The Software:

I wrote a short program to display heading (yaw) values from the 9250, as shown below. The program uses Brian (nox771)’s wonderful i2c_t3 I2C library for the Teensy 3.x & LC controllers, and a modified version of ‘Class_MPU9250BasicAHRS_t3.h/cpp that incorporates an adaptation of Sebastian Madgwick’s “…efficient orientation filter” for 6D0F vs 9DOF.  The modification removes the magnetometer information from the calculations, as I already know that the magnetic field in my environment is corrupted with house wiring and is unreliable.

The modified Madgwick routine is included below

Note to self; after reviewing the extensive email thread with Kris Winer (tleracorp@gmail.com) I now believe I encapsulated all the required modifications to the AHRS code into a new class called “Class_MPU9250BasicAHRS_t3” with Class_MPU9250BasicAHRS_t3.h & .cpp files, and then referenced this new class in my MPU9250 work.

The results:

After getting everything working (and figuring out the history), I finally started getting reliable heading data from the MPU9250 as shown in the following Excel plot, where the breadboard was manually rotated back and forth.

Stay tuned,

 

Frank