All posts by Tim

Capturing individual frames from a USB webcam at full quality

Share

Here’s the method I’m using to create a set of images from a webcam (at 1920×1080) as reliably as possible.

I’m using a simple 2 step process:

First, I’m capturing from the webcam at a constant bitrate with a rather lossless quality
Duration is set to 15 seconds, writing to capture.mp4, overwriting existing files.

ffmpeg -f video4linux2 -input_format yuyv422 -an -i /dev/video0 -r 30 -c:v libx264 -qp 18 -t 15 capture.mp4 -y

Secondly, I’m simply converting the video clip to png:
ffmpeg -i capture.mp4 image_%04d.png

This gets problematic at this quality though:
My 15 seconds video clip is ~13 MB
The 450 png files total over 1.1 GB

Be careful!

P.S.
The purpose for this is to eventually make animated gifs from a purpose built crank camera similar to Otto

Share

PCB design to do list

Share
  • USB to RS232 adapter.
    • Not a cable, just a metal jacket with DB9 connector on one end and a USB-B micro / Mini or maybe Type C
    • FTDI 232R
  • EPS8266 breakout to adapt its header to the quasi-standard FTDI header
  • Front panel USB3 ports for my CoolerMaster Centurion 534+ case
  • RGB LED controller, powered by Atmega 328p or better (Arduino)
  • EPS8266 IR blaster (adapter board)
  • Relay board with Intel Galileo header for sprinkler controller.
Share

Building UEFI for the Galileo

Share

It would seem to me that finding the correct and most up to date components for building UEFI firmware for the Intel Gelileo (1 or 2) would be much easier if all of the code was at tianocore.org (actually sourgeforge / github, but close enough).

Unfortunately, the folks who created the QuarkBSP have either decided to not do that or the legal at Intel has not approved.

Either way, I am keeping notes here for the most straight forward and future-proof method of obtaining the needed components as well as procedures for actually building an EDKII based UEFI firmware for the Galileo Boards.

First, Intel seems to have the most official document here:

This is Intel Doc 329687, as of April 2015, it seems to be at revision 329687-008US

http://www.intel.com/content/www/us/en/embedded/products/quark/quark-x1000-bsp-build-sw-rel-user-guide.html?wapkw=329687
(Hopefully, this link is future proof. If not, just go to Intel.com and search for “329687”)

This guide has a section called “downloading the software”, which points here: https://downloadcenter.intel.com/download/23197

Download the “Board Support Packages for Intel Quark”, you’ll have to agree to honor the Open Source Licenses. Don’t be a jerk, OK? Again, In April, 2015, teh link looks like this: https://downloadcenter.intel.com/downloads/eula/23197/Intel-Quark-BSP?httpDown=http%3A%2F%2Fdownloadmirror.intel.com%2F23197%2Feng%2FBoard_Support_Package_Sources_for_Intel_Quark_v1.1.0.7z

 

Inside the tar.gz, you’ll hopefully see Quark_EDKII_v<x.x.x.x>.tar.gz. Right now, it is “Quark_EDKII_v1.1.0.tar.gz”

This is what you need to build the UEFI firmware for the Galileo.

 

Share

Essay Analogies

Share

I recently found an old email that I sent to my wife (a teacher) in June of 2006, before we started dating. The email is below.

Every year, English teachers from across the country submit their collections of actual analogies and metaphors found in high school essays. These excerpts are published each year to the amusement of teachers across the country. Here are last year’s winners…..

1. Her face was a perfect oval, like a circle that had its two sides gently compressed by a Thigh Master.

2. His thoughts tumbled in his head, making and breaking alliances like underpants in a dryer without Cling Free.

3. He spoke with the wisdom that can only come from experience, like a guy who went blind because he looked at a solar eclipse without one of those boxes with a pinhole in it and now goes around the country speaking at high schools about the dangers of looking at a solar eclipse, without one of those boxes with a pinhole in it.

4. She grew on him like she was a colony of E. Coli, and he was room-temperature Canadian beef.

5. She had a deep, throaty, genuine laugh, like that sound a dog makes just before it throws up.

6. Her vocabulary was as bad as, like, whatever.

7. He was as tall as a six-foot, three-inch tree.

8. The revelation that his marriage of 30 years had disintegrated because of his wife’s infidelity came as a rude shock, like a surcharge at a formerly surcharge-free ATM machine.

9. The little boat gently drifted across the pond exactly the way a bowling ball wouldn’t.

10. McBride fell 12 stories, hitting the pavement like a Hefty bag filled with vegetable soup.

11. From the attic came an unearthly howl. The whole scene had an eerie,surreal quality, like when you’re on vacation in another city and Jeopardy comes on at 7:00 p.m. instead of 7:30.

12. Her hair glistened in the rain like a nose hair after a sneeze.

13. The hailstones leaped from the pavement, just like maggots when you fry them in hot grease.

14. Long separated by cruel fate, the star-crossed lovers raced across the grassy field toward each other like two freight trains, one having left Cleveland at 6:36 p.m. traveling at 55 mph, the other from Topeka at 4:19 p.m. at a speed of 35 mph.

15. They lived in a typical suburban neighborhood with picket fences that resembled Nancy Kerrigan’s teeth.

16. John and Mary had never met. They were like two hummingbirds who had also never met.

17. He fell for her like his heart was a mob informant and she was the East River.

18. Even in his last years, Granddad had a mind like a steel trap, only one that had been left out so long, it had rusted shut.

19. Shots rang out, as shots are known to do.

20. The plan was simple, like my brother-in-law Phil. But unlike Phil, this plan just might work.

21. The young fighter had a hungry look, the kind you get from not eating for a while.

22. He was as lame as a duck. Not the metaphorical lame duck, either, but a real duck that was actually lame, maybe from stepping on a land mine or something.

23. The ballerina rose gracefully en Pointe and extended one slender leg behind her, like a dog at a fire hydrant.

24. It was an American tradition, like fathers chasing kids around with power tools.

25. He was deeply in love. When she spoke, he thought he heard bells, as if she were a garbage truck backing up.

Share

On personal monitor mixing and the state of such technology

Share

So, at my church, like practically every other church in the world, we have a sound system. (It seems that churches that meet in barns in third world countries somehow manage to afford at least a microphone and a speaker or two.) Our church currently uses a Behringer X32 along with a PowerPlay P16-D  and a series of P16M’s for the band members’ personal monitoring.

 

 

I’m a big fan of personal monitoring

for a few simple reasons:

  1. I don’t like mixing monitors:
    • Musicians know what they want, I can only guess (I guess fairly well though).
    • Everyone seems to like different mixes each week.
      • I can’t hear myself (you just woke up, you are quiet)
      • Adjusting mixes when everyone is getting started wastes precious practice time before any given service.
      • This is true not just at my current church, but also each of the 4 churches I have previously attended. (1 growing up, 3 during college)
  2. I don’t like extra stage noise.
    • We already play our music “loud” through the mains, but any extra noise from the stage makes things unbearable.
  3. Room dynamics change between practice and the actual service.
    • I may be blowing smoke here, but a room full of people sounds different.
  4. Musicians play differently when a congregation is present.
    • They deny it, but it is true.
    • If the lead guitar player is suddenly playing louder, the keyboard player will want to be able to quiet it in their mix.
      • This NEVER happens in our church.

Back to the technical details

I mentioned that we use the Behringer system. The P16 is pretty neat because it is cheap ($250 / person) and quite easy to use. We had to buy a “distributor”, the P16-D ($100), which is basically an Ethernet switch that has PoE to power the P16-M’s. For what it does, I think the price is fair.

Of course, when you buy into something that is cheap and affordable, you quickly find out why… there are a maximum of 16 channels in the P16 system. For reference, the X32 is a 32 channel board. Musicians (the collective lot of them) can mix from 16 of those channels + busses that we choose at the board. Put another way, the drummer doesn’t get fine-tuned control of the drums because it would occupy half(ish) of the channel count for the rest of the band. To resolve this, we made a sub-mix of the drums, one for background vocals, one for speaking mic’s (we have maybe 3?), etc.

Why don’t I like this? I don’t like this because even though we have spent almost $2K on the personal monitor system, I still find myself managing too much of the monitoring.

Enter the X-Touch Mini

The X-Touch is a $99 midi controller that has, I swear, just as much control surface as the P16-M in a Midi controller. With what looks to be 2 layer selection buttons an 8 rotary knobs, it has the potential to control the same number of channels as the P16-M. My plan involves a more complicated setup than the Plug-And-Play nature of the P16 though. Midi controlling and routing would have to be individually setup for each controller to select what knobs on each layer control for each musician. That ain’t easy from what I can tell. Additionally, the midi controller route doesn’t provide any actual audio output for headphones. We’d need headphone amps and enough outputs for the band in addition to the Foyer speakers, L+R+C+S and the video send. I believe the system handles 16 outputs, leaving us at 10 for the band. Manageable, but barely.

However, I AM a software engineer who happens to have hardware design experience and I can solve problems like that.  I’m imagining a bridge between either MIDI or USB(USB MIDI) to an IP network for each controller. These would all communicate (probably through a http RESTful API) to a controlling software that performs the mapping from the Controller to the X32 (basically, assigning a given control command from any X-Touch to the specific contorl command on the mixer.) The mapping would need to be easily configurable by the musicians, probably with a mobile webpage accessible from a phone. The remaining task would be to actually send the mapped control data to the X32.

This is where the real power comes into play. The X32 can now be replaced and the only piece that needs to change is the mapping. The control surfaces on the stage can stay the same. I don’t know of a single commercial system that can manage that. Especially for the price.

So, about the implementation, how is it done? Well, Intel has done most of the work for me at rather reasonable prices. Enter the Galileo ($60) and Edison ($50). Each are x86 machines that can talk USB and IP networking.

The Galileo is ready to use with USB Host and Client, as well as 100MB Ethernet. It is WifFi ready when a $15 mPCIE card is added. A few bucks more and you get Bluetooth with the WiFi.

The Edison is brand new as of this month and requires a bit more work. It is a module that can be added to larger boards for power delivery and interfacing. It has no Ethernet options, but has WiFi and Bluetooth built in. USB OnTheGo (host or client, not both) is similarly an add-on option.

With the multiple needed add-ons of the Edison, the Galileo becomes the more ideal choice for me. Here’s how it would be set up:

  • X-Touch mini -> Galileo via USB.
  • Stage Galileos -> central Galileo via IP
  • Central Galileo -> X32 via USB

The Galileo would have code (C, python, Arduino sketch, whatever) to packet-ize the MIDI data and send to the central controller. Communication is either Ethernet or WiFi. Both have similar cost because cat5 isn’t free and neither are the necessary switches. I’d expect similar pricing to a WiFi card. It would be a close decision, but there is still power delivery for the board. The latest version of the Galileo has an option for PoE, which would be very convenient and probably worth any added cost, just to avoid the wall-warts all over the stage.

Now for the “central controller”. This would also be a Galileo board, acting as a computer to talk MIDI directly to the X32. it would be connected to the network via cat5 and powered with a wall-wart since the wiring in the booth is already a mess and always will be.

looking at the cost per musician (not including centralized costs), the

  • P16
    • P16-M $250.
  • Custom design:
    • $99 (X-Touch)
    • $60(Galileo)
    • $15(networking)
    • $20 (enclosure, estimated)
    • $15 (overpriced headphone cable)
    • Total = $209.

My custom solution wins the per-musician cost breakdown.

Moving on to the centralized (one time) cost:

  • P16:
    • $100 for the P-16D to distribute and power the P16-M’s on stage.
  • Custom design:
    • $60 for central Galileo
    • $150 Behringer Powerplay Pro-8 HA8000
      • Headphone amp for 8 musicians
    • Network switch. One of:
      • $100 8-port PoE capable switch
      • $25 8-port (non-PoE) switch
    • Total = $235 – $310

P16 wins this regardless of the WiFi / PoE decision

The real cost is found in the development of a software solution that I don’t think exists yet. To be honest, I already volunteer at church so much, I would hardly notice the additional effort.

I think I’ll start on this sometime soon. I already have 2 Galileo boards, so I’m looking at a $99 investment at this point.


Ideally, if the Galileo was audio capable and someone added a network driver to the Linux kernel that the X32 used, the Galileo would get a straight digital send from the X32 ,reducing the total cost by $150 and allow for > 10 musicians. But alas, I don’t expect such a nice setup anytime soon.

Share