Home Automation Using Ganglion OpenBCI

khantanzidkhantanzid Bangladesh
edited November 2018 in Research
Hi, 

I am new to OpenBCI. I am working on a research project to develop a home automation system using Ganglion board. So far I have made a successful connection with the Arduino and other ports. I am being able to turn on and off an LED. But I am not satisfied with the result that I got. The LED turns on and off as soon as the focus state changes to not focused state; that is a very unstable behavior. 

What I want is that the LED remains on for the first change from focus to not focused state but turns off when I have focused again. I am open to suggestion about any other approach or about using any other widget. It would be really helpful if I could get the Arduino code for this purpose. Any sort of kind gesture is really appreciated. 

Thank You.

Comments

  • wjcroftwjcroft Mount Shasta, CA
    Khan, hi.

    It sounds like you are using an Arduino program that just mirrors the state of the incoming focus values (0 or 1) on the serial port, correct?

    Would it not be easy to mod your Arduino program slightly so that it performs the latching function you desire? In other words, ignore the on to off transitions on the serial port (but record that occurrence in a variable.) Then when the next off to on transition comes in (and your variable is set), turn off the LED or home device.

    Regards,

    William

  • Hi William, 

    Yes this is exactly what i am trying to do. But the data type the GUI sends (boolean) is read as characters buy the arduino ( don't know why though) . Tried data conversion but didn't work. it takes any character of "true" for 0 and "false" for 1 ; and as "e" is common in both cases it remains turned on in both focused and not  focused state. 

    The counter i tried to use didn't work either.

    A quick walkthrough would be really helpful.

    Regards.
  • wjcroftwjcroft Mount Shasta, CA
    edited November 2018
    The GUI is sending ascii numerals, '0' for false and '1' for true. See line 203,


    If your Arduino is receiving other than 0's and 1's, it is a sign something is wrong in your COM port settings, likely the baud rates matching, etc. Make some test programs of your own that test strings on the laptop and see if received correctly by Arduino.

    For example, you can connect a simple terminal emulator on the laptop to your COM port and type characters.

Sign In or Register to comment.