Close

Crystals and blocking timers

A project log for Interactive Disco Dance Floor

A large interactive disco dance floor with hidden capacitive sensors

jeremyJeremy 06/16/2015 at 23:460 Comments

While putting the new boards through their paces we've found a couple small problems.

Crystals and bus communication

To keep the BOM down, the boards were designed without external crystals assuming the AVR's internal oscillator would be good enough for prototyping. The problem we've found is that the oscillator isn't accurate enough to talk on the RS485 bus any faster than 4800 baud. Even then, there are too many dropped packets to make communication viable for testing. The next boards will have crystals!

Capacitive sensors and blocking timers

I've spent the last few weeks working on building a capacitive sensor library that would not block main program execution. The idea was to set an interrupt timer that would check and update the sensor every 5 - 10μs. It's pretty much a non-blocking version of Paul Stoffregen's Capacitive Sensor. The code was lightweight and performed really well...that is, on a prototype that didn't have to do anything else. As soon as I integrated it into the main program, all communication on the bus stopped. Doh! It looks like the timer is still doing too much, too often and getting in the way of everything else.

I'm now going back to an earlier prototype that uses the AVR's input capture interrupt. The results are quite a bit noisier, but it should be more performant.

Discussions