{"id":26650042,"url":"https://github.com/matham/olfcell","last_synced_at":"2025-03-25T01:56:43.824Z","repository":{"id":283707440,"uuid":"951582963","full_name":"matham/olfcell","owner":"matham","description":null,"archived":false,"fork":false,"pushed_at":"2025-03-21T17:08:41.000Z","size":19,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-21T18:21:34.843Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/matham.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-19T23:06:41.000Z","updated_at":"2025-03-21T17:08:45.000Z","dependencies_parsed_at":"2025-03-21T18:21:41.115Z","dependency_job_id":"43a50618-1861-4352-8881-a2464ffa13e3","html_url":"https://github.com/matham/olfcell","commit_stats":null,"previous_names":["matham/olfcell"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matham%2Folfcell","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matham%2Folfcell/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matham%2Folfcell/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matham%2Folfcell/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/matham","download_url":"https://codeload.github.com/matham/olfcell/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245383037,"owners_count":20606265,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-25T01:56:43.259Z","updated_at":"2025-03-25T01:56:43.818Z","avatar_url":"https://github.com/matham.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"NSniff\n======\n\nCeed is an in vitro experiment that stimulates brain slices and records their activity.\n\nFor more information: https://matham.github.io/nsniff/index.html\n\nTo install https://matham.github.io/nsniff/installation.html\n\n.. image:: https://img.shields.io/pypi/pyversions/nsniff.svg\n    :target: https://pypi.python.org/pypi/nsniff/\n    :alt: Supported Python versions\n\n.. image:: https://img.shields.io/pypi/v/nsniff.svg\n    :target: https://pypi.python.org/pypi/nsniff/\n    :alt: Latest Version on PyPI\n\n.. image:: https://coveralls.io/repos/github/matham/nsniff/badge.svg?branch=main\n    :target: https://coveralls.io/github/matham/nsniff?branch=main\n    :alt: Coverage status\n\n.. image:: https://github.com/matham/nsniff/workflows/Python%20application/badge.svg\n    :target: https://github.com/matham/nsniff/actions\n    :alt: Github action status\n\n\nProtocol file\n=============\n\nYou can use a CSV file to import a sequence of hardware states and their duration the program can\nrun through.\n\nThe format of the CSV file is something like\n``duration,valve_banana,valve_apple,valve_kiwi,valve_orange,mfc_1,mfc_2,key,label``.\n\nThere must be a header row that adheres to the labels as follows:\n\n#. ``duration`` is the first row and the duration of this row. That is the state of the hardware will be\n   set to the values of the row and then it'll wait for ``duration``.\n#. ``value_xxx`` is the next ``n`` columns, which is equal to the number of valves (relays) in the system.\n   They are counted from left to right in the GUI which correspond to these ``n`` columns.\n   The column label must be prefixed with ``value_`` and can have any suffix. The suffix can\n   be used to name the odor value etc.\n#. ``value_m`` is the next ``m`` columns, which is equal to the number of MFCs in the system.\n   They are counted from left to right in the GUI which correspond to these ``m`` columns.\n   The column label must be prefixed with ``mfc_`` and can have any suffix. The suffix can\n   be used to name the MFC.\n#. ``key`` is a single character that can be used within the GUI to trigger to run through the sequence\n   of all the rows that contain this character. Or no character, in which case if no character is entered\n   in the GUI, those empty rows will be run through.\n#. ``label`` is any string (not containing commas) that is logged\n\nSoftware installation\n=====================\n\nInstall the dependencies with\n\n```\nsudo apt install python3 python3-dev python3-pip python3-virtualenv\ncd Desktop\npython3 -m virtualenv olfcell_venv\nsource olfcell_venv/bin/activate\n\npip install https://github.com/matham/more-kivy-app/archive/master.zip --timeout=1000\npip install https://github.com/matham/base_kivy_app/archive/master.zip --timeout=1000\npip install https://github.com/matham/kivy-trio/archive/master.zip --timeout=1000\ngit clone https://github.com/matham/pymoa-remote.git\npip install -e pymoa-remote/ --timeout=1000\npip install https://github.com/matham/pymoa/archive/master.zip --timeout=1000\ngit clone https://github.com/matham/olfcell.git\npip install -e olfcell/ --timeout=1000\n```\n\nFinally start the server with `KIVY_NO_ARGS=1 pymoa_quart_app --port port --host \"ip\"`.\n\n\n\nauto start\n------\n\nsudo nano /lib/systemd/system/pymoa_remote.service\n\npaste::\n----\n\n[Unit]\nDescription=MyMoa-remote server\nAfter=multi-user.target network-online.target systemd-networkd-wait-online.service\nWants=network-online.target systemd-networkd-wait-online.service\nRequires=systemd-networkd-wait-online.service\n\n\nStartLimitIntervalSec=1000\nStartLimitBurst=10\n\n[Service]\nRestart=on-failure\nRestartSec=10s\nEnvironment=\"PYMOA_REMOTE_PORT=5378\"\nEnvironment=\"PYMOA_REMOTE_HOST=rasppi03wifi.cplab.cornell.edu\"\nEnvironment=\"KIVY_NO_ARGS=1\"\nEnvironment=\"PYMOA_REMOTE_SERVE=/home/pi/Desktop/venv/bin/pymoa_quart_app\"\nExecStart=/bin/bash -c '$${PYMOA_REMOTE_SERVE} --port $${PYMOA_REMOTE_PORT} --host $${PYMOA_REMOTE_HOST}'\n\n[Install]\nWantedBy=multi-user.target\n\n----\n\nsudo chmod 644 /lib/systemd/system/pymoa_remote.service\nsudo systemctl daemon-reload\nsudo systemctl enable pymoa_remote.service\nsudo systemctl start pymoa_remote\n\nsystemctl status pymoa_remote\n\nsudo journalctl -u pymoa_remote\nhttps://serverfault.com/a/413408\n\nHardware setup\n==============\n\nThe following describes how to set up a Raspberry Pi to control the Stratuscent sensors, valves, and MFCs\nas a remote server that we can connect to and control from another computer on the network.\n\nRPi\n---\n\nThe RPi may come with a noobs SD card or a blank card. Either way we need to install the latest RPi OS directly\nso we can use it headless and connect it to the wifi/ethernet.\n\nInstall the recommended OS (currently Raspberry Pi OS 32-bits) following this\n`guide \u003chttps://www.raspberrypi.org/documentation/installation/installing-images/\u003e`_ using a USB sd card reader.\n\nTo configure the RPi so you can connect over ssh and provide it the WiFi credentials you can either:\n\n1. Use the recommended RPI Imager and in its settings before writing the image to the SD card provide\n   the WiFi etc.\n2. Or we'll provide a file with configuration details after writing to the SD card.\n   Once the OS is installed to the card, open the SD card again on a PC and follow this\n   `guide \u003chttps://www.raspberrypi.org/documentation/configuration/wireless/headless.md\u003e`_. Essentially,\n   in the SD root directory of the ``boot`` partition, create a empty file called ``ssh`` this will enable ssh.\n   Then create a file called ``wpa_supplicant.conf`` as well with contents::\n\n       country=US\n       ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev\n       update_config=1\n\n       network={\n           ssid=\"network-name\"\n           psk=\"password\"\n       }\n\n   replacing the ssid and psk with the WiFi details.\n\nThen, insert the SD card and power ON the RPi, wait a little bit for it to set up and connect to your router.\nThen, log into your router to get the IP of the RPi. Log into the RPi using `ssh pi@ip` with default password\n`raspberry` (unless you changed it).\n\nUpdate the OS using with::\n\n    sudo apt update\n    sudo apt dist-upgrade\n\nIf you would like to connect directly to RPi using ethernet as it is directly connected to your PC, try following\nthis `guide \u003chttps://bigl.es/friday-fun-connecting-to-your-raspberry-pi/\u003e`_.\n\nStratuscent sensors\n-------------------\n\nhttps://community.silabs.com/s/article/cp210x-legacy-programming-utilities?language=en_US\nhttps://inegm.medium.com/persistent-names-for-usb-serial-devices-in-linux-dev-ttyusbx-dev-custom-name-fd49b5db9af1\n\nDo::\n\n    ls /dev/\n    sudo nano /etc/udev/rules.d/99-usb-serial.rules\n    sudo udevadm control --reload-rules \u0026\u0026 sudo udevadm trigger\n    SUBSYSTEM==\"tty\", ATTRS{idVendor}==\"10c4\", ATTRS{serial}==\"10023B\", SYMLINK+=\"SScent10023B\"\n\nConnecting MOD-IO:\n-------------------\n\nIf having issues with the load disconnecting the device, `see this forum \u003chttps://www.olimex.com/forum/index.php?topic=5178.0\u003e`_\n\nUART:\n\nIf using the `UART firmware for the device \u003chttps://github.com/matham/uart_mod_io\u003e`_, do the following\n\n* Run::\n\n      sudo raspi-config\n\n  And expand filesystem and enable serial on advanced page, exit and reboot.\n* Do::\n\n      sudo nano /boot/firmware/config.txt\n\n  And add ``dtoverlay=pi3-disable-bt``.\n* Do::\n\n      sudo nano /boot/firmware/cmdline.txt\n\n  and remove  ``console=serial0,115200`` or (``ttyAMA0``).\n* reboot\n\n\nI2C:\n\nIf using ``I2C``\ndesolder R15 and R17\n\nFollow `this blog to set up \u003chttps://www.abelectronics.co.uk/kb/article/1/i2c-part-2---enabling-i-c-on-the-raspberry-pi\u003e`_\n\nEnable I2C using ``sudo raspi-config``, option 5 and enable it.\nThen do::\n\n    sudo apt install i2c-tools\n    // list all devices\n    sudo i2cdetect -y 1\n    pip install smbus2\n\nIt communicates over I2C and boards can be connected sequentially, but they need to be powered independently.\nBarrel connector power should be 8V-30V DC.\nBlue twin is opto-isolated digital input (same range as power).\nBlue triplet is opto-isolated analog output relay (5A/250VAC).\nGreen is 4 analog inputs (0 - 3.3V).\nUEXT is connected to I2C pins of RPi: connect ground, scl to scl and sda to sda.\nConnect them in series, they each need power.\nUpdate the address from default 0x58 to e.g. 0x22 using ``i2cset -y -f 2 0x58 0xF0 0x22``.\n\n\nADC\n-----\n\nEnable SPI using `sudo raspi-config`, option 5 and enable it.\n\nInstall\n\nsudo apt install python3-pigpio pigpio\npip install pigpio for venv\nsudo pigpiod to start daemon\n\n```\ngit clone https://github.com/ul-gh/PiPyADC.git\n\n```\n\nMFC\n---\n\nUses the ``Waveshare 2-CH RS485 HAT``\n\nKeep 120R\nleave default switches, full-auto\n\n# In /boot/firmware/config.txt:\nsudo nano /boot/firmware/config.txt\n# Add the following, int_pin is set according to the actual welding mode(BCM coding):\ndtoverlay=sc16is752-spi1,int_pin=24\n\nAfter reboot, the driver of SC16IS752 will be loaded into the system\nkernel. At this time, you can run ls /dev to see that there will be more\ndevices as follows:\nttySC0      ttySC1\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatham%2Folfcell","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmatham%2Folfcell","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatham%2Folfcell/lists"}