Announcement

Collapse
No announcement yet.

Receiving input from Arduino devices

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #31
    Originally posted by mrhappy View Post

    I've built a DMX shield with an Uno today that I am going to write a plugin/script for, quite simple to get going really and seems to control simple DMX fixtures relatively easily.
    Hi MrHappy,

    Do you mind sharing the circuit diagram and code you are using for dmx control as I would love to play with this. I have lots of DMX devices at my work and have many uses for this.

    Greig.
    Zwave = Z-Stick, 3xHSM100� 7xACT ZDM230, 1xEverspring SM103, 2xACT HomePro ZRP210.
    X10 = CM12U, 2xAM12, 1xAW10, 1 x TM13U, 1xMS13, 2xHR10, 2xSS13
    Other Hardware = ADI Ocelot + secu16, Global Cache GC100, RFXtrx433, 3 x Foscams.
    Plugings = RFXcom, ActiveBackup, Applied Digital Ocelot, BLDeviceMatrix, BLGarbage, BLLAN, Current Cost, Global Cache GC100,HSTouch Android, HSTouch Server, HSTouch Server Unlimited, NetCAM, PowerTrigger, SageWebcamXP, SqueezeBox, X10 CM11A/CM12U.
    Scripts =
    Various

    Comment


      #32
      Originally posted by enigmatheatre View Post
      Hi MrHappy,

      Do you mind sharing the circuit diagram and code you are using for dmx control as I would love to play with this. I have lots of DMX devices at my work and have many uses for this.

      Greig.
      Sure, it is actually very simple (I was surprised). A single RS485 line driver on one of the outputs and the DMXsimple library and away I went, it is transmit only though. Not sure I would be running anything complex off it, would make an excellent tester device.

      I have attached a photo, there is a header for a bluetooth serial device which worked and the pot just enabled me to send signals straight from the board without relying on serial data (I used it to move a mirror and it did that OK).

      The circuit diagram I have is just where I started and I don't have a finished one but it is so simple that I just added a pot to an analogue input, an LED and the header. This was the code;

      Code:
      /* This program allows you to set DMX channels over the serial port.
      **
      ** After uploading to Arduino, switch to Serial Monitor and set the baud rate
      ** to 9600. You can then set DMX channels using these commands:
      **
      ** <number>c : Select DMX channel
      ** <number>v : Set DMX channel to new value
      **
      ** These can be combined. For example:
      ** 100c355w : Set channel 100 to value 255.
      **
      ** For more details, and compatible Processing sketch,
      ** visit http://code.google.com/p/tinkerit/wiki/SerialToDmx
      **
      ** Help and support: http://groups.google.com/group/dmxsimple       */
      
      #include <DmxSimple.h>
      
      int outputValue = 0;
      int intest = 1; //internal testing using potentiometer
      
      void setup() {
        Serial.begin(9600);
        Serial.println("?DMXLOADED");
        randomSeed(analogRead(0));
      }
      
      int value = 0;
      int channel;
      
      void loop() {
        int c;
          
        if (intest == 0) {;     
        
        outputValue = map(analogRead(A3), 0, 1023, 0, 20); 
        DmxSimple.write(1, random(20, 235));
        delay(outputValue * 100);  
        DmxSimple.write(2, random(20, 235));
        delay(outputValue * 100);
        DmxSimple.write(3, random(30, 222));
        delay(outputValue * 100);
        DmxSimple.write(4, random(150, 238));
        delay(outputValue * 100);
        
        } else {;
      
        while(!Serial.available());
        c = Serial.read();
        if ((c>='0') && (c<='9')) {
          value = 10*value + c - '0';
        } else {
          if (c=='C') channel = value;
          else if (c=='V') {
            DmxSimple.write(channel, value);
            Serial.println("?OK");
          }
          value = 0;
        } 
        }
      }
      The above code is somewhat modified from an example I found on the net, I send simple serial commands from HS in the format (ChNo)C(ChValue)V(Send) and it then sends the command. I did write a plugin for it but it was probably overkill as it proved a little difficult to run fades/chases reliably.
      Last edited by mrhappy; March 22, 2013, 09:55 PM.

      Comment


        #33
        Originally posted by mrhappy View Post
        Sure, it is actually very simple (I was surprised). A single RS485 line driver on one of the outputs and the DMXsimple library and away I went, it is transmit only though. Not sure I would be running anything complex off it, would make an excellent tester device.

        I have attached a photo, there is a header for a bluetooth serial device which worked and the pot just enabled me to send signals straight from the board without relying on serial data (I used it to move a mirror and it did that OK).

        The circuit diagram I have is just where I started and I don't have a finished one but it is so simple that I just added a pot to an analogue input, an LED and the header. This was the code;

        Code:
        /* This program allows you to set DMX channels over the serial port.
        **
        ** After uploading to Arduino, switch to Serial Monitor and set the baud rate
        ** to 9600. You can then set DMX channels using these commands:
        **
        ** <number>c : Select DMX channel
        ** <number>v : Set DMX channel to new value
        **
        ** These can be combined. For example:
        ** 100c355w : Set channel 100 to value 255.
        **
        ** For more details, and compatible Processing sketch,
        ** visit http://code.google.com/p/tinkerit/wiki/SerialToDmx
        **
        ** Help and support: http://groups.google.com/group/dmxsimple       */
        
        #include <DmxSimple.h>
        
        int outputValue = 0;
        int intest = 1; //internal testing using potentiometer
        
        void setup() {
          Serial.begin(9600);
          Serial.println("?DMXLOADED");
          randomSeed(analogRead(0));
        }
        
        int value = 0;
        int channel;
        
        void loop() {
          int c;
            
          if (intest == 0) {;     
          
          outputValue = map(analogRead(A3), 0, 1023, 0, 20); 
          DmxSimple.write(1, random(20, 235));
          delay(outputValue * 100);  
          DmxSimple.write(2, random(20, 235));
          delay(outputValue * 100);
          DmxSimple.write(3, random(30, 222));
          delay(outputValue * 100);
          DmxSimple.write(4, random(150, 238));
          delay(outputValue * 100);
          
          } else {;
        
          while(!Serial.available());
          c = Serial.read();
          if ((c>='0') && (c<='9')) {
            value = 10*value + c - '0';
          } else {
            if (c=='C') channel = value;
            else if (c=='V') {
              DmxSimple.write(channel, value);
              Serial.println("?OK");
            }
            value = 0;
          } 
          }
        }
        The above code is somewhat modified from an example I found on the net, I send simple serial commands from HS in the format (ChNo)C(ChValue)V(Send) and it then sends the command. I did write a plugin for it but it was probably overkill as it proved a little difficult to run fades/chases reliably.

        MrHappy,

        Thank you for all the info.
        I would like to use the arduino as a DMX Node and it looks like I can with your info on the library.
        I think i will order up some parts and give this a go.

        Greig.
        Zwave = Z-Stick, 3xHSM100� 7xACT ZDM230, 1xEverspring SM103, 2xACT HomePro ZRP210.
        X10 = CM12U, 2xAM12, 1xAW10, 1 x TM13U, 1xMS13, 2xHR10, 2xSS13
        Other Hardware = ADI Ocelot + secu16, Global Cache GC100, RFXtrx433, 3 x Foscams.
        Plugings = RFXcom, ActiveBackup, Applied Digital Ocelot, BLDeviceMatrix, BLGarbage, BLLAN, Current Cost, Global Cache GC100,HSTouch Android, HSTouch Server, HSTouch Server Unlimited, NetCAM, PowerTrigger, SageWebcamXP, SqueezeBox, X10 CM11A/CM12U.
        Scripts =
        Various

        Comment


          #34
          Wireless instead of USB

          Hi guys,

          Instead of connecting to one or multiple Arduinos via USB, why not using a wireless Arduino software compatible solution?
          http://www.panstamp.com

          panStamp provides libraries, sample sketches and carrier boards with sensors (including DHT22, TMP36, BMP085, ...) and actuators (relays. 0-10V outputs, RGB). Tons of applications for Home Automation at a fraction of the price of an Arduino UNO.

          Comment


            #35
            What hardware would be needed for the arduino to send messages to the computer for homeseer? Do you need a wireless shield or something?

            Comment


              #36
              Originally posted by BtrSound View Post
              What hardware would be needed for the arduino to send messages to the computer for homeseer? Do you need a wireless shield or something?
              You can do it via the USB socket if your Arduino is close to the PC. There are a number of ways depending on a number of factors really, do you need wireless is the main one. If you are using a wired connection then serial is my preference for ease, LAN is possible but it just becomes more complex.

              Comment


                #37
                Originally posted by estratos View Post
                Hi guys,

                Instead of connecting to one or multiple Arduinos via USB, why not using a wireless Arduino software compatible solution?
                http://www.panstamp.com

                panStamp provides libraries, sample sketches and carrier boards with sensors (including DHT22, TMP36, BMP085, ...) and actuators (relays. 0-10V outputs, RGB). Tons of applications for Home Automation at a fraction of the price of an Arduino UNO.
                So, have you ever used anything of them ? Can you control them via Homeseer wirelessly?

                Comment


                  #38
                  Originally posted by coolgas View Post
                  So, have you ever used anything of them ? Can you control them via Homeseer wirelessly?
                  Nope. There is no current integration of panStamp with HomeSeer. It might be done via serial if the SWAP protocol is implemented in HS or via IP through lagarto (https://code.google.com/p/panstamp/wiki/lagarto), the open source server for panStamp.

                  Comment


                    #39
                    Originally posted by estratos View Post
                    Nope. There is no current integration of panStamp with HomeSeer. It might be done via serial if the SWAP protocol is implemented in HS or via IP through lagarto (https://code.google.com/p/panstamp/wiki/lagarto), the open source server for panStamp.
                    I was able to wirelessly link two Arduinos using Zigbee modules - and then integrate it with HomeSeer (using the code from this Thread). One Arduino is connected via USB to the PC running HomeSeer. My plan (if I ever get the time) is to setup a separate mesh network using Zigbee/Arduino to integrate my own projects throughout my house.

                    Comment


                      #40
                      Originally posted by Alan View Post
                      I was able to wirelessly link two Arduinos using Zigbee modules - and then integrate it with HomeSeer (using the code from this Thread). One Arduino is connected via USB to the PC running HomeSeer. My plan (if I ever get the time) is to setup a separate mesh network using Zigbee/Arduino to integrate my own projects throughout my house.
                      Very nice job! But you have to write some code for every arduino to communicate with Zigbee right?
                      I will try another approach for wireless communication. There are
                      433Mhz RF transmitter receiver link kit,

                      two small pcbs that sends and receives data, one kit for every sensor. It's price is ultra low (1 pound/kit) bought from ebay.


                      http://www.ebay.co.uk/itm/433Mhz-RF-...item5d44ce6e26


                      So, If I connect an arduino via usb, control it via homeseer with this page's plugin and connect wireless RF pcbs (for remote sensor operation), it does not need any coding, right?

                      Comment


                        #41
                        Originally posted by zakrzep View Post
                        I use and Arduino for a few temp/humidity sensors and send the data every min. Not pretty, but has worked flawlessly. Here is part of my Arduino code. I just send a name=value to the serial port. You can do all of your calculations/conversions on the Arduino and send it to the Arduino or send the raw data and do all of your calculations in a Homeseer script.

                        IndoorTempSensor.measure(&temperature, &humidity, &dewpoint);
                        Serial.print("Temp1stFloor=");
                        serialPrintFloat(temperature*9/5 + 32);
                        Serial.print(13, BYTE);
                        Serial.print("Humidity1stFloor=");
                        serialPrintFloat(humidity);
                        Serial.print(13, BYTE);


                        Then in Homeseer, I have the following script run on homeseer startup:

                        ' com port script to send data to a COM port
                        ' this script registers a callback script named com_event.txt
                        ' when data is received on the COM port the com_event.txt script is called and the
                        ' data can be processed there
                        ' this script only needs to be called once as the com port will stay open

                        sub main()
                        dim e

                        e=hs.OpenComPort(5,"9600,n,8,1",1,"com_event_Ardunio1.txt"," main",chr(13))
                        if e <> "" then
                        hs.writelog "Error opening com port",e
                        end if

                        hs.writelog "comport_open_Arduino1.txt","Script Complete"
                        end sub


                        Then one more script file named "com_event_Ardunio1.txt" that fires on com port activity from statement above:

                        sub main(data)

                        ' process the com port data here

                        i = Instr(data,"=")

                        varName=trim(left(data,i-1))
                        result=trim(right(data,len(data) - i))
                        result=cint(Round(result,2))

                        If varName = "Humidity1stFloor" and hs.DeviceValue("[14") <> result Then
                        hs.setDeviceValue "[14", result
                        End if

                        If varName = "Temp1stFloor" and hs.DeviceValue("[15") <> result Then
                        hs.setDeviceValue "[15", result
                        End if

                        end sub
                        Hi!
                        Can you tell me what sensors are you using?
                        Thank you

                        Comment

                        Working...
                        X