Navigation

    • Register
    • Login
    • OpenHardware.io
    • Categories
    • Recent
    • Tags
    • Popular
    1. Home
    2. vikmad
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

    vikmad

    @vikmad

    0
    Reputation
    4
    Posts
    405
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online
    Website domaciautomatizace.blogspot.cz/ Location Prague

    vikmad Follow

    Best posts made by vikmad

    This user hasn't posted anything yet.

    Latest posts made by vikmad

    • RE: Serial gateway using Arduino Mega, how to set what serial to use ?

      On my Arduino Mega works for me this:

      // Enable debug prints to serial monitor
      //#define MY_DEBUG
      //#define MY_DEBUG_HWSERIAL Serial // = Serial0 / Rx0 & Tx0 to programming & debug 
      
      
      // Enable serial gateway
      #define MY_GATEWAY_SERIAL
      #define MY_SERIALDEVICE Serial3 // Rx3 & Tx3 to Gateway
      
      
      // Enable RS485 transport layer
      #define MY_RS485
      #define MY_RS485_HWSERIAL Serial1 // Rx1 & Tx1 to RS485 network 
      #define MY_RS485_BAUD_RATE 9600
      #define MY_RS485_DE_PIN 22
      

      I tried to edit a library MyHwAVR.cpp for MY_DEBUG_HWSERIAL, but without any positive result.:

      #ifdef MY_DEBUG
      #ifndef MY_DEBUG_HWSERIAL
      #define MY_DEBUG_HWSERIAL MY_SERIALDEVICE
      #endif
      void hwDebugPrint(const char *fmt, ... )
      {
      	char fmtBuffer[MY_SERIAL_OUTPUT_SIZE];
      #ifdef MY_GATEWAY_FEATURE
      	// prepend debug message to be handled correctly by controller (C_INTERNAL, I_LOG_MESSAGE)
      	snprintf_P(fmtBuffer, sizeof(fmtBuffer), PSTR("0;255;%d;0;%d;"), C_INTERNAL, I_LOG_MESSAGE);
      	MY_DEBUG_HWSERIAL.print(fmtBuffer);
      #else
      	// prepend timestamp (AVR nodes)
      	MY_DEBUG_HWSERIAL.print(hwMillis());
      	MY_DEBUG_HWSERIAL.print(" ");
      #endif
      	va_list args;
      	va_start (args, fmt );
      #ifdef MY_GATEWAY_FEATURE
      	// Truncate message if this is gateway node
      	vsnprintf_P(fmtBuffer, sizeof(fmtBuffer), fmt, args);
      	fmtBuffer[sizeof(fmtBuffer) - 2] = '\n';
      	fmtBuffer[sizeof(fmtBuffer) - 1] = '\0';
      #else
      	vsnprintf_P(fmtBuffer, sizeof(fmtBuffer), fmt, args);
      #endif
      	va_end (args);
      	MY_DEBUG_HWSERIAL.print(fmtBuffer);
      	MY_DEBUG_HWSERIAL.flush();
      
      	//MY_DEBUG_HWSERIAL.write(freeRam());
      }
      #endif
      

      The code above does not work!

      posted in Hardware
      vikmad
      vikmad
    • RE: rs485 on nano

      @dbemowsk It works now. To sketch, I added the line: #define MY_NODE_ID xx

      Arduino IDE 1.8.1, MySensors Library v2.1.1:

      • Upload ClearEepromConfig
      • Upload MotionSensorRS485
        = not working

      • Add #define MY_NODE_ID 1 to MotionSensorRS485 and upload
        = working

      posted in General Discussion
      vikmad
      vikmad
    • RE: rs485 on nano

      Many hours I solved why MySe485 example does not work 😠 ... I tried Mega, Uno, Mini, Nano, reinstallation of IDE, libraries, ClearEepromConfig, HWserial / AltSoftSerial / direct (Tx <> Rx) + (Rx <> TX) without MAX485 ...

      The other day I came across this forum and the solution is:

      #define MY_NODE_ID xx

      I saw a bug that RS485 communication is bad, because it is illegible. My mistake, the communication between GW and the node is not readable ASCII ...

      RS485 communication: Node waiting to GW respone:
      0_1485894929734_upload-fb5458be-c704-4c5a-9377-61558ce658c5

      posted in General Discussion
      vikmad
      vikmad
    • RE: MySensors with Atmega8(L) ?

      // EDIT and ADD in: ...Arduino\libraries\MySensors\drivers\AVR\DigitalIO\DigitalPin.h

          #if defined(__AVR_ATmega168__)\
          ||defined(__AVR_ATmega168P__)\
          ||defined(__AVR_ATmega8__)\
          ||defined(__AVR_ATmega328P__)
          // 168 and 328 Arduinos
      

      // EDIT and ADD IN: ...Arduino\libraries\MySensors\drivers\AVR\DigitalWriteFast\digitalWriteFast.h

       #elif defined(ARDUINO_AVR_UNO) || defined(ARDUINO_AVR_DUEMILANOVE) || defined(__AVR_ATmega328__) || defined(__AVR_ATmega328P__) || defined(__AVR_ATmega8__) || defined(__AVR_ATmega328PB__)
      

      // ADD to Sketch Code:

      //Name conversion R.Wiersma
      #define UCSR0A UCSRA
      #define UDR0 UDR
      #define UDRE0 UDRE
      #define RXC0 RXC
      #define FE0 FE
      #define TIFR1 TIFR
      #define WDTCSR WDTCR

      #define WDIE 6
      #define WDCE 4

      // DISABLE debug! small memory 😞
      //#define MY_DEBUG

      I did not test on HW, I just tried to compile it (DimmableLEDActuator):

      0_1484920625423_obrazek.png

      posted in General Discussion
      vikmad
      vikmad