allenneuraldynamics / harp.device.lickety-split Goto Github PK
View Code? Open in Web Editor NEWan ephys-compliant capacitive lick detector
License: MIT License
an ephys-compliant capacitive lick detector
License: MIT License
The firmware needs to be able to diagnose that "no excitation signal is present."
This fault can happen on boards that have issues in their analog front-end circuitry or cables that were connected incorrectly. Without plugging in an oscilloscope probe, this issue is very hard to diagnose.
Since the LTC6263 opamps max out at 2.5V, we should use the REF2025 instead of the REF2033 to produce a midscale and maximum voltage reference. REF2025's voltage outputs are 1.25V and 2.5V, while the REF2033's are 1.65V and 3.3V. With the offset and gain setup on the final opamp, we're seeing clipping.
Here's what PCB V0.6.0 with REF2033 shows now (no cable plugged in):
And here's the same PCB V0.6.0 with REF2033 replaced with REF2025 (still no cable plugged in):
With the REF2025, the signal gain can reach its full scale swing instead of being clipped, and the resulting measurement will have slightly higher resolution.
The final offset sine wave has these transient spikes that are making the signal more difficult to read.
This is mentioned in the datasheet, but it was unclear how strong the effect would be.
I was hoping that the sine wave wouldn't look like a transient load, but it seems like that is not the case.
It looks like this voltage reference is going to suffer if we draw out any non-negligible amount of current from it.
One solution is to increase the voltage divider impedance by a factor of 10 such that R23 + R24 >= 200K.
Another solution would be to consolidate the gain and offset stage into one opamp (summing amplifier) where R1 + R2 >= 200K in the figure below
(See Design Gain and Offset in 30 Seconds)
A final option would be to buffer the reference voltage before feeding it into the existing voltage divider.
The LTC6263 can't source more than 20mA per output, but the ADS7049 ADC requires a low impedance source. We need to bump the 68ohm resistors to ~127 ohm to keep the overall maximum current <20mA while keeping the unintended lowpass filter cutoff frequency >2MHz.
It's not clear that this is a baseline issue, but odds are good since it is always adapting. It's worth considering:
Currently, the lick detection threshold reads as 0. This is because core1 never passes the value from core 1 to core0. It only writes values from core0 to core1. We need to change this such that the Harp register reads correctly.
The pico-sdk is huge, and it is possible that the end-user already has it installed on their machine elsewhere. Since there are compilation instructions that show how to point to the pico-sdk and we're not critically dependent on a pinned version of it, let's consider removing it.
On Rev2 of the circuit board, we can see the following behavior.
When R23 = 1MOhm, the 100KHz AC signal on the output of the LTC6268 buffer is ~25% of what is should be. This could be explained with about 5pF of stray capacitance, where 5pF = 318KOhm @ 100KHz. (See Impedance Calculator.)
Since the opamp input capacitance is only 0.1pF, it's likely that the majority of the capacitance is coming either from the parasitic capacitance of the board itself or from the SMA connector.We should be getting around 94% of the signal without any cable plugged in. If that's the case, a guard trace around the opamp positive input trace should cut down the majority of the capacitance. I will test this on the next revision.
The 100KHz source pin is the only remaining pin exposed on the board that is not ESD protected. It would be prudent to add protection here.
In practice, we generally use hex keys to screw/unscrew parts together. It wold be prudent to get the M3 or M4 version of this part with the Phillips screw not included so that we can install a socket cap screw instead.
(Datasheet for reference.)
At the core, the lick detector is using a change-detection algorithm to detect licks.
This are many well-documented ways of doing this (PDF). And while the Lick Detector scheme is basically the CUSUM algorithm, it's not obvious. Let's make some algorithm tweaks to make the code more familiar to people with a CUSUM background.
Oof; because 3.5mm audio cable plugs don't really standardize their outer diameter, it's worth playing on the safe side and moving the PCB closer to the edge so that it is flush with the edge or even sticks out a bit. The enclosure will also need to be adjusted.
From testing, it seems like we're getting some 1-2MHz noise from external devices. For a bit more ruggedness, it's worth tightening up the filter to 4th order to be on the safe side.
Here's a 4th order Bandpass filter made from 0.1% resistors and 1% ceramic (NP0) capacitors.
(generated with Analog Devices filter wizard.)
Note that there are subtle differences in values.
Should ideally live in the same website as the rest of AIND packages documentation (https://allenneuraldynamics.github.io/bonsai.allen-neural-dynamics/)
Should also include a getting started workflow example.
We need to make room for the rubber feet, so moving the QR code away from the edge would be ideal.
As is, accessing the testpoint will require opening the case. Since this testpoint might actually be used to help someone debug their setup, it's worth moving it closer to the edge of the board where it could be accessed through a hole in the case without opening it.
Following the prototype v0.5 (release), here are some tweaks we should make.
Either
General Tweaks
It is possible to boot the Lickety Split board where commands sent to the AD9833 are ignored, and the 100KHz sine wave does not start generating.
Possible fixes:
The first fix is the easiest, but it is also slightly more difficult to detect because of #6 .
Currently the firmware triggers external TTL outputs, but we'd like to migrate to full harp compliance. Here's the register breakdown:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.