nickpetersen93 / LIQ_HD

Lick Instance Quantifier Home cage Device
6 stars 0 forks source link

Having a few problems, also have a few question #3

Closed J-M-Cecil closed 1 month ago

J-M-Cecil commented 6 months ago

Hey there! I set everything up a slightly modified version of this for my lab but we're having a few problems.

Modifications:

1) Instead of the provided bottles and 'Device CLIP 10mm' cad part I designed my own part that interfaces with a premade bottle. The interface works in the exact same way.

2) Some minor CAD changes on the cases for cosmetic purposes

3) Some minor cosmetic changes to the code (only messed with the logos that come up)

Problems: 1) The main issue we're having is that the lick count increases on its own during testing. After hitting "Start!", the lick monitoring screen comes up, and I'll tap/rub opening to a bottle with a wet finger, but I get no response. I hit Refresh and all values stay 0:0. After about a minute however, the values increase by themselves. Typically the first values are around 150:30 (L:R, with right side being experimental). After another minute, the values increase by roughly the same amount. I'm not sure if it's reading the test 'licks' I do or something else entirely.

2) The SD card fails a few minutes into a recording session. I'll plug things in, hit "Start!" and the lick monitoring screen comes up. More often than not, in a couple minutes, the screen dims and a error page pops up that says "SD card failed or not inserted" along with the date and time of the failure.

Questions: 1) What does the hardware actually measure/ what is the computer actually reading? When the mice lick, is there a voltage drop that's measured? Or is there a capacitance change? Mostly just curious on this one.

2) Is there a built in test function somewhere where you get an immediate indication every time a bottle is "licked?"

Thanks for your time.

nickpetersen93 commented 6 months ago

Hey there, Happy to see you've made modifications to fit your needs! Are you using mice or rats, and what brand and model of cage are you using? Once you have it up and running smoothy, we would love to be able to share your models with the community!

From the sounds of it, you may be getting "ghost licks" due to the sensor threshold being too low. Given your modifications to the design, the current lick threshold settings may not be appropriate and will likely need adjustment. The default settings are also designed for mice, so the use of rats will definitely require changes to the settings. Also, the way the code is written, it will only update the numbers for the screen every minute (even if you hit refresh). One way to test the detected licks in real time is to physically look at the MPR121 sensor board. There is a small red LED on each board that turns on every time a sensor is touched or released. Using this is useful to quickly check if you are getting ghost licks or if it was just counting your finger taps with the minute delay in the screen. It is also important to note that touching the wires can sometime set off the sensors, so it is important to avoid touching the wires while the system is running.

The sensors measure a change in capacitance, similar to a touch screen on a smart phone. So, touching the sensor with your hand with generate a large change in capacitance, whereas a mouse's tongue will generate a very small change in capacitance. With that said, it is important to test these setting using the actual experimental environment. I just uploaded a code that I use to test sensor settings! Simply upload it to your Arduino of your built LIQ system and open the serial plotter on the Arduino IDE (with the Arduino plugged into your computer). You can then play around with the touch and release thresholds to determine your optimal settings. A lick will be detected with the recorded value goes above the "touch_threshold" and will end the lick when the value goes below the "release_threshold". It is best to keep the release_threshold at about half the value of the touch_threshold. It can be a bit frustrating to wait for an animal to lick, so we will sometimes take a space cage of mice (group housed) and put 10% sucrose (or something similar) in the bottles to increase the likelihood that the animals will lick.

As far as your SD card problem, it may be a couple different issues. I'm not sure why, but we have had some SD cards in the past that have given us the same problem and we eventually just replaced those cards with new ones and it fixed the problem. The Arduino will also sometimes malfunction if the lick threshold settings are too low and it is picking up a lot of erratic ghost licks, which may be your issue. I made some minor tweaks to the SD error function with the most recent code update, so I would also try that if you haven't yet.

Hope this helps! Nick