# Timing accuracy & Interrupts

**URL:** <https://community.particle.io/t/timing-accuracy-interrupts/6201>\
**Category:** Getting Started\
**Created:** [August 5, 2014, 4:16am UTC](https://community.particle.io/t/timing-accuracy-interrupts/6201 "2014-08-05T04:16:32Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![BDub](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/bdub/32/5137_2.png) [@BDub](https://community.particle.io/u/BDub)\
**Post date:** [August 5, 2014, 6:40am UTC](https://community.particle.io/t/timing-accuracy-interrupts/6201/2 "2014-08-05T06:40:26Z")

</div>

> [@scsc\_tech](#):
>
> Can the Spark record this timing down to the millisecond?

infinity and beyond! Down to the nanoseconds 🙂

> [@scsc\_tech](#):
>
> How many vibration sensors can I put on the Spark?

16! That's how many digital inputs the Spark Core has 😄

> [@scsc\_tech](#):
>
> Will they sense in an interrupt fashion where the code can keep running and count the time to impact each sensor individually so I can report a summary?  
> How do I accommodate for latency in wire length between the sensors and Spark? Its likely to be a few meters (do I need signal amplification?)

You can implement 12 interrupt routines:  
[http://docs.spark.io/firmware/#interrupts-attachinterrupt](http://docs.spark.io/firmware/#interrupts-attachinterrupt)

But you might be able to just poll your sensors very quickly. If you are all set with 12, go for interrupts. You may have some issues though...

Have a look at this interrupt driven pinewood derby code I wrote:

> **[Stopwatch for Pinewood Derby](https://community.particle.io/t/stopwatch-for-pinewood-derby/3486/17)**
>
> Ok! 1:41am… Pinewood Derby code keeping me up! These interrupts and timing really don’t work like they should. I had to get in there are TAKE OVER!!! When I get some sleep I’ll explain WHY I had to do what I did. EDIT: I updated the header...

> [@BDub](#):
>
> How do I accommodate for latency in wire

Electrons travel at the speed of light typically (well close to that anyways).. so wirelength only affects resistance of the wire, coupled with any capacitance on your input you can have an RC timeconstant affect... basically the slew rate of the signal transitions can be governed by this capacitance. Fortunately it's really small... all you need to do is pull up your vibration sensor with a lower value resistor, say 1k ohm from the sensor input pin to 3V3. Then tie your vibration sensor from the sensor input to ground. When the sensor wiggles you'll get a bunch of HIGH to LOW transitions.

---

_[View the full topic](https://community.particle.io/t/timing-accuracy-interrupts/6201)._
