Use cyton without a computer

Would it be possible to use EMG with a cyton board to trigger an alarm? It would require having the algorithm integrated and a buzzer connected.

Comments

  • wjcroftwjcroft Mount Shasta, CA
    edited June 2022

    Skiria,

    Yes, sure, if you modify the firmware. I might suggest at power-up, you test for one of the available Dxx digital pins to be in such a state as to indicate you desire "stand alone" mode. If this is the case you enter your custom program loop. If the pin is NOT in the special state, you just proceed with normal default Cyton operation.

    This way you can easily revert to 'normal' mode for use with the GUI.

    https://docs.openbci.com/Cyton/CytonSDK/#board-mode

    available pins are D11, D12 and D17. If no wifi present then also D13 and D18.

    Regards, William

  • Makes sense. So in this case I wouldn't need the dongle, correct?
    When you say, test for on if the pins to be in such state, what do you mean? Do you have any example or pseudo code?

  • wjcroftwjcroft Mount Shasta, CA

    You can jumper the header socket (pin) for the desired Dxx to GND or Vdd to force it to 0 or 1 respectively. (If using Vdd, best to jumper with a 1K resistor, as a pull-up.) I believe an un-jumpered pin will appear as 0. You choose what pin you want to use. Check the Cyton firmware source code for how to read Dxx pins.

    re: dongle. Since you are entirely bypassing the normal mainboard Arduino firmware loop, none of the normal operation characteristics apply. So dongle is not used.

  • wjcroftwjcroft Mount Shasta, CA

    I want to clarify the statement I made above: "...Since you are entirely bypassing the normal mainboard Arduino firmware loop, none of the normal operation characteristics apply..."

    This is not actually the case, you will still need to setup the basic Arduino-style processing loop, loop() {...} as shown here:

    https://github.com/OpenBCI/OpenBCI_Cyton_Library/blob/master/examples/DefaultBoard/DefaultBoard.ino

    However you will be augmenting the loop with your own code that processes the channel data sample(s) as they are being collected. Since you are doing relatively simple EMG processing, there might not be much signal processing or filtering involved. But your choice. You'll probably have to do some signal averaging and thresholding.

    As you saw from the '...OpenBCI_32bit_Library.cpp#L3308' example above, you check your external 'mode' pin with the digitalRead(pin_number) function. If this logic level is on (let's call it 'buzz_mode'), you will need to insert some 'bypass' code in certain sections of the functions called by the main loop. Such as those parts of the firmware that are trying to send out the samples (packets) to the RFduino for transmission to the dongle.

    You will also need to setup any SDK modes / commands desired (there may be none), and start the data stream. To start the data stream you could check your buzz_mode, in the setup() function, and if on, call streamStart() .

    If you are not using Cyton elements such as Daisy or Wifi, you could omit those calls from the loop function.

  • Thanks so much! That's very useful! I'll report progress and ask further questions!

  • wjcroftwjcroft Mount Shasta, CA

    Regarding the Dxx jumper, I suggest ALWAYS use a 1K or 10K resistor as the jumper. This is because the PIC32 GPIO pins can be configured as inputs or outputs, also as either analog or digital mode. Since the pins are configured for input or output in the firmware, a misconfigured pin could result in PIC32 damage if set for output and the jumper wire connected directly to GND or Vdd.

Sign In or Register to comment.