Can't use Feather user COM port once fed3.run() is used.

79 views
Skip to first unread message

Fabrice de Chaumont

unread,
Mar 10, 2022, 5:11:26 AM3/10/22
to FEDforum
Hi !

Thanks for bringing the FED 3 ! Amazing device !

I am trying to bring the FED3 to the Live Mouser Tracker ( http://livemousetracker.org )  users to have realtime communication with your device.

It seems that once the fed3.run() is used the user port is somehow disabled. (at least it does not show up anymore on my computer )

Any idea ?

Best

Fabrice de Chaumont

FEDforum

unread,
Mar 10, 2022, 1:56:57 PM3/10/22
to FEDforum
Thanks for your kind words, and this sounds like a really cool integration!  Are you trying to keep a Serial connection active while using FED3?  The issue is that when the Feather board sleeps it disconnects the USB controller, and when it wakes up it doesn't always re-connect it (last I checked this was a known issue on the Adafruit forums).  The best way to test if this is the problem is to disable sleep mode.  You can do this by calling "fed3.disableSleep();" in the void setup loop, right after fed3.begin(), and then re-flashing the FED3.  See below, let me know if you need more instruction than that!

fed3.begin();
fed3.disableSleep();

With sleep modes disabled the USB Serial should stay connected.  The main downside to disabling sleep is that it will shorten the battery life of the device, but if you are planning to keep the Serial connection wired all the time this won't matter to you. 

Last point - if this connection still doesn't work you can also send combinations of TTL pulses from the output port to sync with other devices.  So you can do a scheme like 1 pulse = left poke, 2 pulses = right poke, etc, to label different events.  We often do this when we sync FED3 with brain recordings. 

Please write back if this works!  -Lex

Fabrice de Chaumont

unread,
Mar 22, 2022, 10:56:31 AM3/22/22
to FEDforum
Dear Lex,

Thanks for your answer, I did not try your solution yet... because I rewrote what I needed... :)

As I did not understand why I was loosing the COM port, I read all your code and I wrote an API that is slightly different from yours. Let me explain this :)

My main constraint is to drive several FED3 for an experiment where mice can go in different locations. So the logic is moved from the individual FED3 to a python program that manages all the FEDs and other third-party devices. Therefore all the FEDs are always connected in USB.

By reading your API, I saw that you are using "blocking logic" (that is very cool and very stable for most cases as you are not in concurrent state) such as when an animal is nose poking in a hole, then the system is waiting thanks to a "while" block and waits for this poke to stop. But as we have several animals, I wanted non-blocking logic to be able to monitor what is happening in the other hole at the same time. So I removed all the "while" to continuously monitor the device (so I rewrote a minimal API for that:).

I also added a very simple layer to control and receive data from the COM port.

I found a very little bug if you perform a nose poke while the system is trying to feed, then for the next try, the system may only perform one sector-turn of the motor, and if no pellet is delivered, it just does not deliver. I will try to give you the exact pattern to reproduce it.

I added an event "pellet picked by animal" that I did not find in the original API but I am pretty sure it exists somewhere :)

thanks ***A LOT*** for your device ! This is a super-great beast, I have it in my backpack and I keep telling to people I met how great this is ! You should see more orders placed soon :) And I did not advertise yet the live mouse tracker community with it until the system is not 100% done, but I am sure this will be a success !

Best

Fabrice

Lex Kravitz

unread,
Mar 24, 2022, 12:08:06 AM3/24/22
to FEDforum
Hi Fabrice,
Thanks for your kind words and enthusiasm, what you're doing sounds super interesting!  I really look forward to seeing what you do with FED3 and the LMT, it sounds like you've got it under control but please let me know if/how I can help! 

Please also let me know how to replicate the bug you discovered, I'll try to re-create it as well.  Best, -Lex
Reply all
Reply to author
Forward
0 new messages