Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Communication modes ESP-host PC and communication protocols #17

Open
amchagas opened this issue Oct 2, 2020 · 0 comments
Open

Communication modes ESP-host PC and communication protocols #17

amchagas opened this issue Oct 2, 2020 · 0 comments
Labels

Comments

@amchagas
Copy link
Member

amchagas commented Oct 2, 2020

We need to figure out a good way to establish communication in between BeeHive and the computer that will be used to analyse data/send commands/read data from BeeHive.

Here are three ideas on how this could be implemented also open to more suggestions:

1- All data generated by BeeHive gets stored locally in the ESP (or connected SD card system) and the data only gets transferred to a computer after the tasks/protocols/experiments are completed.

  • Even though simple, this system does not allow for closed loop experiments/protocols where there is no realtime transmission of data
  • Experiments become limited in their time duration as the ESP has a limited memory.

2 - Similar to Pyphotometry, the data generated during protocols get temporarily stored in ring buffers, and is transmitted at semi regular intervals, whenever one of the buffers is full. This is a more elegant solution and allows for virtually infinitely long experiments as data is transferred to a computer with very large storage. Here it would be interesting to program the ESP in a way that the computer can send commands and change the behaviour of the ESP, allowing for smart calculations to be done in real time on the computer, changing experiments on the go. In other words, this is closer to a closed loop application.

3 - We could program the ESP in a way that is basically waiting for commands from the computer which is connected to it. Once a command is received, the ESP executes said command and returns to this waiting mode. This is similar to the current flypi implementation, and also similar to the use of the FIRMATA protocol in Arduino the quesiton here would be how fast can we make this communication. Ideally we would like to get this to millisecond/submillisecond loops, so that we can still run behavioural experiments. Micropython has an imcomplete implementation of Firmata and circuit python (Adafruit's version of micropython, wih some mods) has another. In tihs case, we could even use a C++/arduino implementation of firmata, since the idea is that this stock code would be uploaded by the users once and they could forget about programming the the ESP.

  • I think number 3 is a good implementation for fast prototyping with the board, but maybe not fast enough to transmit all the data back and forth in realtime (even though this would be a great solution). Also I am not sure if these implementations also run on wireless connections.

communication protocols

Since the ESPs will be used either with the USB cable, or using wirelles connection, we have looked into two communicaiton protocols to start with:

1- Wireless communication with the OSC protocol, which is well established and used for audio and video applications, making it fast enough for our use cases.

2 - Serial communication via the USB cable to the host computer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant