Page 1 of 1

Adafruit Trinket - 12MHz fast enough?

Posted: Sun Aug 02, 2015 9:16 am
by scraff
I'm interested in the pro trinket.
I am setting up sound trigulation using some sparkfun sound detectors.

I set up my code on the RPi, set up listening events for the sound detectors, but the RPi seems too busy multitasking to come up with accurate timings for the reading. The readings should be as low as 0.0001 seconds apart but the RPi reads these at around 0.0004 Sec apart. It works to a degree but it's just not quite good enough for the accuracy I need.

Enter a microcontroller(?). The pro trinket (opted for this as it's smaller than the Arduino Uno). However it states:
The Pro Trinket 3V runs at 12MHz, this doesn't affect most projects. Only the most timing-specific libraries may be affected
How time specific does it mean? Would it be good enough for my project?

Thanks

Re: Adafruit Trinket - 12MHz fast enough?

Posted: Sun Aug 02, 2015 9:31 am
by joan
pigpio will give you relative timings in the 10µs range and better on the Pi.

How are you ensuring that the devices are equally sensitive?

Re: Adafruit Trinket - 12MHz fast enough?

Posted: Sun Aug 02, 2015 11:08 am
by scraff
joan wrote:pigpio will give you relative timings in the 10µs range and better on the Pi.
How are you ensuring that the devices are equally sensitive?
Hi,

I hadnt thought too much about is they are equally as sensitive. They are the exact same part so had just assumed...
Not sure how to test this, but will look it up.

As for pigpio, are you saying that it will be better to use this on the Pi rather than other custom/dedicated code on Pro Trinket?

Thanks

Edit: I will look into pigpio, but just incase, would the Pro Trinket be fast enough? (ie if I decided to go down that route) Thanks

Re: Adafruit Trinket - 12MHz fast enough?

Posted: Sun Aug 02, 2015 11:43 am
by joan
scraff wrote: ...
I hadnt thought too much about is they are equally as sensitive. They are the exact same part so had just assumed...
Not sure how to test this, but will look it up.

As for pigpio, are you saying that it will be better to use this on the Pi rather than other custom/dedicated code on Pro Trinket?
...
The Trinket or an Arduino should work. The only problem is they are geared up to doing one thing at a time so I'm not sure how you'd get the two or three timings you would need. Also you have the problem of getting the data back to the Pi.

Using pigpio will be a lot simpler and will exceed your stated needs. It should allow you to find out if you actually need better timings.

What sort of sound do you plan to use as the trigger?

Re: Adafruit Trinket - 12MHz fast enough?

Posted: Sun Aug 02, 2015 12:21 pm
by scraff
Hi Joan,

Ok thanks. I shall take a good look at that.
At the moment the trigger is the GATE output on the Sparkfun Sound Detector, it sets off a pulse automatically at a certain sound level. The code (I dont have my RPi on so cant paste the exact code) simply listens for the GPIO rising on the Sound Detectors, when it senses one rising it just simply records the time of each and then subtracts one from the other to calculate the time difference.

The problem at the moment is that there is always 0.0004 secs or more than there should be on the time difference. This isnt so bad while im just testing it out, because at the moment (as a poor work around), Ive just subtracted 0.0004 off the given time difference which gives an OK measurement (within about 10-20% accuracy) ...but it can every 1 in 5 readings be off by 50% or more, which will be no good for the final project.

But if PIGPIO can take the readings real time, this would be exactly what I need.