Git Product home page Git Product logo

harp.device.lickety-split's People

Contributors

bruno-f-cruz avatar poofjunior avatar

Watchers

 avatar

harp.device.lickety-split's Issues

"No signal" should be flagged as an error.

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.

Switch REF2033 to REF2025

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):
PXL_20231113_195430693

And here's the same PCB V0.6.0 with REF2033 replaced with REF2025 (still no cable plugged in):
PXL_20231113_220539410

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.

Voltage Reference introduces transient spikes

The final offset sine wave has these transient spikes that are making the signal more difficult to read.

PXL_20231003_183912378

This is mentioned in the datasheet, but it was unclear how strong the effect would be.
Screenshot from 2023-10-03 11-35-49

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
Screenshot from 2023-10-03 11-48-19

(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.

1st Draft TODOs

Core Design Features

  • < 1ms lick detection latency
  • no false positives
  • Ephys-invisible

Core Board Features

  • RP2040 + 16MB ram
  • Isolated full speed USB
  • Harp synchronizer input
  • SWD input
  • serial debug port input
  • dual analog and digital power supply (analog front end and digital circuitry)
  • dual analog power supply for opamps
  • 100KHz clean sine wave generation
  • single lick detection input
  • 60Hz noise rejection
  • solenoid noise rejection with low-voltage-triggering TVS diodes

Bringup

Harp Core PCB

  • Bringup Harp Core on a PCB
  • Confirm active shielding stage works
  • Confirm bandpass filtering stage works

Considerations

  • investigate if we need active guarding on first opamp input.

Docs

  • choose the right license(s)
  • cable/hookup specs for lick spout
  • document design (schematic + design choices)
  • document lick tube cable

Testing

  • Test USB Isolator with Adafruit ADUM4160 breakout. Ensure no additional latency has been introduced.
  • Test final breadboarded analog front-end design with a probed mouse

Update R42, R43 to reduce maximum current

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.

Baseline should update more slowly and indicate state.

  • The device should indicate when the baseline value has settled.
  • The baseline, as-is, may be updating too slowly, causing us to miss some licks in a series of licks. See image below.

PXL_20231207_194946592

It's not clear that this is a baseline issue, but odds are good since it is always adapting. It's worth considering:

  • updating the baseline more slowly
  • not updating the baseline while we are tripped up to a certain time threshold.

thresholds should be readable and writeable across cores

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.

Consider removing pico-sdk as a submodule

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.

Extra 5pF stray capacitance on PCB Rev2

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.

Switch Ground Lug to 7790 or 7792

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.)

Clean up algorithm to be more user-friendly

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.

Move "Harp Sync" (audio) jack closer to PCB Edge

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.

Bandpass filter could be stronger

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.

Screenshot from 2023-10-13 13-37-45
(generated with Analog Devices filter wizard.)
Note that there are subtle differences in values.

Make testpoint more easily accessible

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.

Final PCB Rev Board Tweaks

Following the prototype v0.5 (release), here are some tweaks we should make.
Either

  • Change vertical SMA testpoint connector to smaller testpoint (Candidate: Keystone 5027.) We want to encourage users to use probes with a 10x setting, rather than plug it straight into the oscilliscope.
    Or
  • Make the SMA testpoint 10x setting compatible when plugged directly into an oscilloscope and annotate it as such on the silkscreen (oscilloscope probe schematic). This may be less favorable than just exposing a testpoint stud.

General Tweaks

  • Change button to a button that is compatible with an aqueous wash
    • 435431019840 link and 435451019820 link are both <$1 and comparable in size to the previous switch
  • Update silkscreen date
  • Dim the LEDs with bigger resistors(?)
  • Change Debug header to SMD

AD9833 sometimes ignores commands

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:

  • detect this condition and re-issue commands to the chip
  • scrap the AD9833 and...
    • get an SPI DAC
    • filter a 100KHz square wave

The first fix is the easiest, but it is also slightly more difficult to detect because of #6 .

Harpification App Requirements

Currently the firmware triggers external TTL outputs, but we'd like to migrate to full harp compliance. Here's the register breakdown:

Register Requirements

  • lick state
    • contains the current state of all lick detectors, where each bit encodes a state.
  • on trigger threshold
  • off trigger threshold
  • reset trigger
  • state machine status (whether or not the lick detectors are stable, etc.)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.