Skip to content
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
J

jeti

@jeti
  • Getting Started
  • Controller
  • Build
  • Hardware
  • Download/API
  • Forum
  • Store
About
Posts
78
Topics
12
Shares
0
Groups
0
Followers
0
Following
2

Posts

Recent Best Controversial

  • 💬 Dimmable LED Actuator
    J jeti

    so this works now like a charm:

    // Enable debug prints to serial monitor
    #define MY_DEBUG 
    
    // Enable and select radio type attached
    #define MY_RADIO_NRF24
    //#define MY_RADIO_RFM69
    
    #define MY_NODE_ID 153 
    
    #include <SPI.h>
    #include <MySensors.h> 
    
    #define SN "MultiDimmableLED"
    #define SV "1.1"
    
    #define noLEDs 3
    const int LED_Pin[] = {3, 5, 6}; 
    
    #define FADE_DELAY 25  // Delay in ms for each percentage fade up/down (10ms = 1s full-range dim)
    
    static int currentLevel = 0;  // Current dim level...
    MyMessage dimmerMsg(noLEDs, V_DIMMER);
    MyMessage lightMsg(noLEDs, V_LIGHT);
    
    
    
    /***
     * Dimmable LED initialization method
     */
    void setup()  
    { 
      // not sure this works
      // Pull the gateway's current dim level - restore light level upon sendor node power-up
    for (int sensor=1; sensor<=noLEDs; sensor++){
      request( sensor, V_DIMMER );
     }
    }
    
    void presentation() {
      // Register the LED Dimmable Light with the gateway
     for (int sensor=1; sensor<=noLEDs; sensor++){
     present(sensor, S_DIMMER);
     wait(2);
     }
      sendSketchInfo(SN, SV);
    }
    
    /***
     *  Dimmable LED main processing loop 
     */
    void loop() 
    {
    }
    
    
    
    void receive(const MyMessage &message) {
      if (message.type == V_LIGHT || message.type == V_DIMMER) {
        
        //  Retrieve the power or dim level from the incoming request message
        int requestedLevel = atoi( message.data );
        
        // Adjust incoming level if this is a V_LIGHT variable update [0 == off, 1 == on]
        requestedLevel *= ( message.type == V_LIGHT ? 100 : 1 );
        
        // Clip incoming level to valid range of 0 to 100
        requestedLevel = requestedLevel > 100 ? 100 : requestedLevel;
        requestedLevel = requestedLevel < 0   ? 0   : requestedLevel;
        
        Serial.print( "Changing LED " );
        Serial.print(message.sensor);
        Serial.print(", PIN " );
        Serial.print( LED_Pin[message.sensor] );
        Serial.print(" level to " );
        Serial.print( requestedLevel );
        Serial.print( ", from " ); 
        Serial.println( currentLevel );
    
        
        fadeToLevel( requestedLevel, message.sensor );
        
        // Inform the gateway of the current DimmableLED's SwitchPower1 and LoadLevelStatus value...
        send(lightMsg.set(currentLevel > 0 ? 1 : 0));
    
        // hek comment: Is this really nessesary?
        send( dimmerMsg.set(currentLevel) );
    
        
        }
    }
    
    /***
     *  This method provides a graceful fade up/down effect
     */
    void fadeToLevel( int toLevel, int ledid ) {
    
      int delta = ( toLevel - currentLevel ) < 0 ? -1 : 1;
      
      while ( currentLevel != toLevel ) {
        currentLevel += delta;
        analogWrite(LED_Pin[ledid-1], (int)(currentLevel / 100. * 255) );
        wait( FADE_DELAY );
      }
    }```
    
    thank you :thumbsup:
    Announcements

  • 💬 Sensebender Gateway
    J jeti

    @tekka thanks! that did the trick!

    OpenHardware.io mysensors gateway samd

  • Another all-in-one PCB
    J jeti

    Hi all,

    as many of you already did your own design, I also started working on that, as any other solution only covered 75% of my whishes :disappointed: .
    Therefore i established my own :bowtie: , but as I am a beginner in Hardwaredesign I would like to ask for your opinion to do as little mistakes as possible.

    What i wanted:

    • arduino Pro mini (china)

    • 2 LED Dimmer circuits

    • 1Wire for SHt7021 and light sensor

    • DS18b20 connection

    • PIR connection

    • small form factor (no mounting holes needed yet)

    thats what i came up with (KiCad files):
    0_1459080161874_Mysensor_1.pdf
    0_1459080236009_Mysensors_01.kicad_pcb
    0_1459080257370_Mysensors_01.sch

    It would be great to get some feedback about layout and the schematics!

    thanks in advance!

    My Project

  • RFID Reader ID-3LA
    J jeti

    @mfalkvidd:
    also with S_INFO amd V_TEXT the gateway only receives a "1"...

    I just searched and played a little more and i got i working now:

     /**
     * ID-3LA       Arduino
     * -----      -------
     * GND   ->   GND
     * VCC   ->   +3.3V
     * D0   ->   D5
     * D1   ->   D6
     * FORM -> GND
     */
    
    // Enable debug prints to serial monitor
    #define MY_DEBUG 
    
    // Enable and select radio type attached
    #define MY_RADIO_NRF24
    //#define MY_RADIO_RFM69
    
    #define MY_NODE_ID 102 
    
    #include <SPI.h>
    #include <MySensors.h>  
    #include <SoftwareSerial.h>
    
    SoftwareSerial rfid = SoftwareSerial(5, 6);
    int  val = 0; 
    char code[10]; 
    int bytesread = 0; 
    
    #define CHILD_ID 1   // Id of the sensor child
    
    MyMessage KeyMsg(CHILD_ID, V_VAR1);
    
    void setup()  
    {
      Serial.begin(9600);
      rfid.begin(9600);
      //Serial.println("Ready");
    }
    
    void presentation()  {
      sendSketchInfo("RFID Reader", "1.0");
      present(CHILD_ID, S_CUSTOM);
    }
    
    void loop(){
    if(rfid.available() > 0) {          // if data available from reader 
        if((val = rfid.read()) == 10) {   // check for header 
          bytesread = 0; 
          while(bytesread<10) {              // read 10 digit code 
            if( rfid.available() > 0) { 
              val = rfid.read(); 
              if((val == 10)||(val == 13)) { // if header or stop bytes before the 10 digit reading 
                break;                       // stop reading 
              } 
              code[bytesread] = val;         // add the digit           
              bytesread++;                   // ready to read next digit  
            } 
          } 
          if(bytesread == 10) {              // if 10 digit read is complete 
            Serial.print("TAG code is: ");   // possibly a good TAG 
            Serial.println(code);            // print the TAG code 
          } 
          bytesread = 0; 
         Serial.println(code);
         send(KeyMsg.set(code)); 
         
        }
      }
    }
    

    The issue seemed to be the string, now with a char it works...

    now i only need to get reset the reader every now an then to recognice if a tag is removed. The reader only updates when a tag enters the reading adistance but not when it leaves it.

    thanks!

    Troubleshooting

  • 💬 EFEKTA Temperature & Humidity mini sensor
    J jeti

    @berkseo do you have a 3d Model of the Sensor? I could support with designing a housing if you want!

    OpenHardware.io temperature atmega328 battery humidity atmega 328p-mu

  • [contest] My 12 input high precision pulse counter (kWh/ W)
    J jeti

    ok found the answer :stuck_out_tongue:
    the latest Time.h is only pointing to TimeLib.h so if I am calling TimeLib.h (instead of Time.h) directly it compiles

    My Project [contest]

  • first RFM node & Gateway !TSM:FPAR:FAIL (solved)
    J jeti

    Hi all,

    as the fake NRFs are kind of annoing with ther varying ranges i decied to give the RFMs a try.
    Therefore i gut a sensberger gateway with following sketch:

    /**
     * The MySensors Arduino library handles the wireless radio link and protocol
     * between your home built sensors/actuators and HA controller of choice.
     * The sensors forms a self healing radio network with optional repeaters. Each
     * repeater and gateway builds a routing tables in EEPROM which keeps track of the
     * network topology allowing messages to be routed to nodes.
     *
     * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
     * Copyright (C) 2013-2015 Sensnology AB
     * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
     *
     * Documentation: http://www.mysensors.org
     * Support Forum: http://forum.mysensors.org
     *
     * This program is free software; you can redistribute it and/or
     * modify it under the terms of the GNU General Public License
     * version 2 as published by the Free Software Foundation.
     *
     *******************************
     *
     * REVISION HISTORY
     * Version 1.0 - Henrik EKblad
     * Contribution by a-lurker and Anticimex,
     * Contribution by Norbert Truchsess <norbert.truchsess@t-online.de>
     * Contribution by Tomas Hozza <thozza@gmail.com>
     *
     *
     * DESCRIPTION
     * The EthernetGateway sends data received from sensors to the ethernet link.
     * The gateway also accepts input on ethernet interface, which is then sent out to the radio network.
     *
     * The GW code is designed for Arduino 328p / 16MHz.  ATmega168 does not have enough memory to run this program.
     *
     * LED purposes:
     * - To use the feature, uncomment MY_DEFAULT_xxx_LED_PIN in the sketch below
     * - RX (green) - blink fast on radio message recieved. In inclusion mode will blink fast only on presentation recieved
     * - TX (yellow) - blink fast on radio message transmitted. In inclusion mode will blink slowly
     * - ERR (red) - fast blink on error during transmission error or recieve crc error
     *
     * See http://www.mysensors.org/build/ethernet_gateway for wiring instructions.
     *
     */
    
    // Enable debug prints to serial monitor
    #define MY_DEBUG
    
    // Enable and select radio type attached
    //#define MY_RADIO_NRF24
    #define MY_RADIO_RFM69
    
    // Enable gateway ethernet module type
    #define MY_GATEWAY_W5100
    
    // W5100 Ethernet module SPI enable (optional if using a shield/module that manages SPI_EN signal)
    //#define MY_W5100_SPI_EN 4
    
    // Enable Soft SPI for NRF radio (note different radio wiring is required)
    // The W5100 ethernet module seems to have a hard time co-operate with
    // radio on the same spi bus.
    #if !defined(MY_W5100_SPI_EN) && !defined(ARDUINO_ARCH_SAMD)
    #define MY_SOFTSPI
    #define MY_SOFT_SPI_SCK_PIN 14
    #define MY_SOFT_SPI_MISO_PIN 16
    #define MY_SOFT_SPI_MOSI_PIN 15
    #endif
    
    // When W5100 is connected we have to move CE/CSN pins for NRF radio
    #ifndef MY_RF24_CE_PIN
    #define MY_RF24_CE_PIN 5
    #endif
    #ifndef MY_RF24_CS_PIN
    #define MY_RF24_CS_PIN 6
    #endif
    
    // Enable to UDP
    //#define MY_USE_UDP
    
    #define MY_IP_ADDRESS 192,168,1,82   // If this is disabled, DHCP is used to retrieve address
    // Renewal period if using DHCP
    //#define MY_IP_RENEWAL_INTERVAL 60000
    // The port to keep open on node server mode / or port to contact in client mode
    #define MY_PORT 5003
    
    // Controller ip address. Enables client mode (default is "server" mode).
    // Also enable this if MY_USE_UDP is used and you want sensor data sent somewhere.
    //#define MY_CONTROLLER_IP_ADDRESS 192, 168, 178, 254
    
    // The MAC address can be anything you want but should be unique on your network.
    // Newer boards have a MAC address printed on the underside of the PCB, which you can (optionally) use.
    // Note that most of the Ardunio examples use  "DEAD BEEF FEED" for the MAC address.
    #define MY_MAC_ADDRESS 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
    
    // Enable inclusion mode
    #define MY_INCLUSION_MODE_FEATURE
    // Enable Inclusion mode button on gateway
    //#define MY_INCLUSION_BUTTON_FEATURE
    // Set inclusion mode duration (in seconds)
    #define MY_INCLUSION_MODE_DURATION 60
    // Digital pin used for inclusion mode button
    //#define MY_INCLUSION_MODE_BUTTON_PIN  3
    
    // Set blinking period
    #define MY_DEFAULT_LED_BLINK_PERIOD 300
    
    // Flash leds on rx/tx/err
    // Uncomment to override default HW configurations
    //#define MY_DEFAULT_ERR_LED_PIN 7  // Error led pin
    //#define MY_DEFAULT_RX_LED_PIN  8  // Receive led pin
    //#define MY_DEFAULT_TX_LED_PIN  9  // Transmit led pin
    
    
    #if defined(MY_USE_UDP)
    #include <EthernetUdp.h>
    #endif
    #include <Ethernet.h>
    #include <MySensors.h>
    
    
    void setup()
    {
    }
    
    void loop()
    {
    }
    

    which seems to work nicely:

    thats the only debug i get:
    "0;255;3;0;9;MCO:BGN:STP
    0;255;3;0;9;MCO:BGN:INIT OK,TSP=1"

    for the only node i use this sketch (which worked fine with a nrf), this is a Arduino Nano with some I-button readers:

    // Enable debug prints to serial monitor
    #define MY_DEBUG 
    
    // Enable and select radio type attached
    //#define MY_RADIO_NRF24
    #define MY_RADIO_RFM69
    
    #define MY_NODE_ID 102 
    
    #include <SPI.h>
    #include <MySensors.h>  
    #include <OneWire.h>
    
    // This is the pin with the 1-Wire bus on it
    OneWire ds_1(3);
    OneWire ds_2(4);
    OneWire ds_3(5);
    OneWire ds_4(6);
    
    
    
    
    // unique serial number read from the key
    byte addr_0[8];
    byte addr_1[8];
    int addr_1_last;
    byte addr_2[8];
    int addr_2_last;
    byte addr_3[8];
    
    // poll delay (I think 750ms is a magic number for iButton)
    int del = 750;
    
    #define CHILD_ID_1 1
    #define CHILD_ID_2 2
    #define CHILD_ID_3 3
    
    MyMessage ReadMsg_1(CHILD_ID_1, V_VAR1);
    MyMessage ReadMsg_2(CHILD_ID_2, V_VAR2);
    MyMessage ReadMsg_3(CHILD_ID_3, V_VAR3);
    
    void setup() {
      Serial.begin(115200);
    }
    
    void presentation()  {
      sendSketchInfo("iButton Reader", "1.0");
      present(CHILD_ID_1, S_CUSTOM);
      present(CHILD_ID_2, S_CUSTOM);
      present(CHILD_ID_3, S_CUSTOM);
    }
    
    void loop() {
    byte result;
    
      // search looks through all devices on the bus
       ds_1.reset_search();
         for( int i = 0; i < 8;  ++i )
      addr_1[i] = (char)0;
       ds_1.search(addr_1);
    //   Serial.println(ds_1.crc8(addr_1,7));
      if(ds_1.crc8(addr_1,7) == 0 && addr_1_last == 0) {
    /*    Serial.print("Reader 1a: ");
        for(byte i=0; i<8; i++) {  
          Serial.print(addr_1[i], HEX);
          Serial.print(" "); }
          Serial.print("\n"); */
      send(ReadMsg_1.set(0)); 
    addr_1_last = 1;
       /*   Serial.print("addr_1_last: ");
          Serial.print(addr_1_last);
          Serial.print("\n"); */
      for( int i = 0; i < 8;  ++i )
      addr_1[i] = (char)0;
      }  
      else if (ds_1.crc8(addr_1,7) >> 0  && addr_1_last == 1){
        
       /*   Serial.print("Reader 1b: ");
         for(byte i=0; i<8; i++) {
          Serial.print(addr_1[i], HEX);
          Serial.print(" ");}
          Serial.print("\n"); */
        send(ReadMsg_1.set(addr_1,HEX)); 
         addr_1_last = 0;
       /*  Serial.print("addr_1_last: ");
     //   for(byte i=0; i<8; i++) {  
          Serial.print(addr_1_last);
      //    Serial.print(" "); }
      Serial.print("\n"); */
      }
       ds_2.reset_search();
         for( int i = 0; i < 8;  ++i )
      addr_2[i] = (char)0;
       ds_2.search(addr_2);
     //  Serial.println(ds_2.crc8(addr_2,7));
      if(ds_2.crc8(addr_2,7) == 0 && addr_2_last == 0) {
     /*   Serial.print("Reader 2a: ");
        for(byte i=0; i<8; i++) {  
          Serial.print(addr_2[i], HEX);
          Serial.print(" "); }
          Serial.print("\n"); */
      send(ReadMsg_2.set(0)); 
    addr_2_last = 1;
      /*    Serial.print("addr_2_last: ");
          Serial.print(addr_2_last);
          Serial.print("\n"); */
      for( int i = 0; i < 8;  ++i )
      addr_2[i] = (char)0;
      }  
      else if (ds_2.crc8(addr_2,7) >> 0  && addr_2_last == 1){
        
       /*   Serial.print("Reader 2b: ");
         for(byte i=0; i<8; i++) {
          Serial.print(addr_2[i], HEX);
          Serial.print(" ");}
          Serial.print("\n"); */
        send(ReadMsg_2.set(addr_2,HEX)); 
         addr_2_last = 0;
       /*  Serial.print("addr_2_last: ");
     //   for(byte i=0; i<8; i++) {  
          Serial.print(addr_2_last);
      //    Serial.print(" "); }
      Serial.print("\n");    */
      }
    
      delay(del);
      return;
      }
    

    where i get this debug:
    "0 MCO:BGN:INIT NODE,CP=RRNNA--,VER=2.1.1
    3 TSM:INIT
    4 TSF:WUR:MS=0
    6 TSM:INIT:TSP OK
    8 TSM:INIT:STATID=102
    10 TSF:SID:OK,ID=102
    11 TSM:FPAR
    3133 TSF:MSG:SEND,102-102-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    5140 !TSM:FPAR:NO REPLY
    5142 TSM:FPAR
    8264 TSF:MSG:SEND,102-102-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    10271 !TSM:FPAR:NO REPLY
    10273 TSM:FPAR
    13395 TSF:MSG:SEND,102-102-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    15403 !TSM:FPAR:NO REPLY
    15405 TSM:FPAR
    18527 TSF:MSG:SEND,102-102-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    20534 !TSM:FPAR:FAIL
    20535 TSM:FAIL:CNT=1
    20537 TSM:FAIL:PDT"

    a capacitor is already in place on the node.
    Am i looking into a Gateway or node issue here? any suggestions?

    thanks in advance

    Troubleshooting
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular