Close

Printer

A project log for Demolition Man Verbal Morality Statute Monitor

Project to build a working swear detector to enforce the verbal morality statute from the movie Demolition Man.

tdicolatdicola 03/30/2014 at 02:140 Comments

Added support for the thermal printer, and swapped to a small amplifier & speaker.  Take a look at the video for more information: 

In the process of integrating the printer I ported the Adafruit thermal printer Arduino library to POSIX/Linux too if anyone is curious.

The only gotcha integrating the printer is dealing with the fact that both the audio needs to play and the printer needs to print a ticket at the same time.  Each task needs some periodic updates from the main program--the audio buffer needs to be kept full of samples, and the printer needs to be told what to print next.  Since the Pi is rather limited in CPU resources (one core at 700mhz), I went with a non-blocking I/O approach in a tight loop instead of something like multi-threading or multiple processes.  So far things work well and the code isn't too ugly by using some nice C++11 stuff like lambdas.

Next step will be to work on the speech recognition.  I'm going to investigate adapting the speech model for my microphone or voice to see if it improves the accuracy.  Right now the false positive rate isn't too bad, but some small swear words like 'fuck' or 'damn' are easy for it to misinterpret because they sound like normal parts of speech.

I also plan on adding a switch to put it into a 'quiet' mode where it might flash a light on swear detect, but otherwise not alarm.

Also starting to think a little more about getting it put into a case that looks like the real prop.  Luckily the prop isn't that complex--it's really just a cylinder with curved box on one end.  Looking at stuff around the house I see an oatmeal container is just about the perfect size cylinder to fit the printer.  Thin cardboard wouldn't be too difficult to bend into the box shape, and aluminum tape covering the whole thing would give it a metallic look.  More investigation into that later.

Discussions