Skip to content

Hardware

1.8k Topics 18.4k Posts

Talk about fun sensor hardware, MCUs, PCBs and how to power your sensors here.

  • Sample: ESP gateway with sensor

    2
    0 Votes
    2 Posts
    2k Views
    A
    @gloob I only commented out my network id/ passw/ and ip config A counter is included ;-) /** * 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 Ivo Pullens (ESP8266 support) * * DESCRIPTION * The EthernetGateway sends data received from sensors to the WiFi link. * The gateway also accepts input on ethernet interface, which is then sent out to the radio network. * * VERA CONFIGURATION: * Enter "ip-number:port" in the ip-field of the Arduino GW device. This will temporarily override any serial configuration for the Vera plugin. * E.g. If you want to use the defualt values in this sketch enter: 192.168.178.66:5003 * * LED purposes: * - To use the feature, uncomment any of the MY_DEFAULT_xx_LED_PINs in your sketch, only the LEDs that is defined is used. * - 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/esp8266_gateway for wiring instructions. * nRF24L01+ ESP8266 * VCC VCC * CE GPIO4 * CSN/CS GPIO15 * SCK GPIO14 * MISO GPIO12 * MOSI GPIO13 * GND GND * * Not all ESP8266 modules have all pins available on their external interface. * This code has been tested on an ESP-12 module. * The ESP8266 requires a certain pin configuration to download code, and another one to run code: * - Connect REST (reset) via 10K pullup resistor to VCC, and via switch to GND ('reset switch') * - Connect GPIO15 via 10K pulldown resistor to GND * - Connect CH_PD via 10K resistor to VCC * - Connect GPIO2 via 10K resistor to VCC * - Connect GPIO0 via 10K resistor to VCC, and via switch to GND ('bootload switch') * * Inclusion mode button: * - Connect GPIO5 via switch to GND ('inclusion switch') * * Hardware SHA204 signing is currently not supported! * * Make sure to fill in your ssid and WiFi password below for ssid & pass. */ // Enable debug prints to serial monitor #define MY_DEBUG // Use a bit lower baudrate for serial prints on ESP8266 than default in MyConfig.h #define MY_BAUD_RATE 9600 // Enables and select radio type (if attached) #define MY_RADIO_NRF24 #define MY_RF24_CHANNEL 83 // radio channel, default = 76 //#define MY_RADIO_RFM69 #define MY_GATEWAY_ESP8266 #define MY_ESP8266_SSID "<your SSID" #define MY_ESP8266_PASSWORD "<your passw>" // Enable MY_IP_ADDRESS here if you want a static ip address (no DHCP) #define MY_IP_ADDRESS 192,168,2,120 // If using static ip you need to define Gateway and Subnet address as well #define MY_IP_GATEWAY_ADDRESS 192,168,2,254 #define MY_IP_SUBNET_ADDRESS 255,255,255,0 // The port to keep open on node server mode #define MY_PORT 5003 // How many clients should be able to connect to this gateway (default 1) #define MY_GATEWAY_MAX_CLIENTS 2 // 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, 68 // 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 // Led pins used if blinking feature is enabled above //#define MY_DEFAULT_ERR_LED_PIN 16 // Error led pin //#define MY_DEFAULT_RX_LED_PIN 16 // Receive led pin //#define MY_DEFAULT_TX_LED_PIN 16 // the PCB, on board LED #if defined(MY_USE_UDP) #include <WiFiUdp.h> #endif #define NODE_TXT "AWI_ESP 120" // Text to add to sensor name #include <ESP8266WiFi.h> #include <MySensors.h> unsigned long SLEEP_TIME = 10000; // Sleep time between reports (in milliseconds) #define CHILD_ID 1 // Id of the sensor child #define CHILD_ID2 2 // Id of the sensor child //#define LED_GREEN 12 //#define LED_BLUE 13 #define LED_RED 16 //#define ADC A0 // Initialize message MyMessage msg(CHILD_ID, V_PERCENTAGE); MyMessage msg2(CHILD_ID2, V_TEXT); int messageCounter = 0 ; // Count the outgoing messages for validation (0..99) void setup() { delay(1); } void presentation() { // Present locally attached sensors here // Send the sketch version information to the gateway and Controller sendSketchInfo(NODE_TXT, "1.0"); // Register all sensors to gw (they will be created as child devices) present(CHILD_ID, S_DIMMER, NODE_TXT " dimmer"); present(CHILD_ID2, S_INFO, NODE_TXT " text"); } void loop() { // Send locally attached sensors data here send(msg.set(messageCounter)); // Send message to gw messageCounter = ++messageCounter % 100 ; // wrap send(msg2.set("Hallo")); // Send message to gw // Send update every SLEEP_TIME wait(SLEEP_TIME) ; } void receive(const MyMessage &message) { // messages from node or controller //char printBuf[40] ; //Serial.print(message.getInt()); //sprintf(printBuf, "Message node: %d %d OK\n", message.sender, message.getInt()); } //Serial.print(printBuf) ; //sprintf(printBuf, "Messages: %d Errors: %d\n", messageCounter, messageErrorCounter); //Serial.print(printBuf) ;
  • Help hacking a LED outdoor security light motion sensor

    8
    0 Votes
    8 Posts
    3k Views
    breimannB
    @AWI i've since done some more work on this and discovered the switched 3.95v didn't share a common ground with the rest of the circuit. So i ended up hooking up a DIL reed relay PRMA 0105 (5v) onto it, and used the relay contacts to connect to pin D3 on my nano. So i've got it operating that whenever the motion sensor is tripped it toggles my 1 channel relay board, but what isn't working is being able to manually switch it from in domoticz. Would someone be able to take a look at my code which i've taken from this thread My code is: /* DESCRIPTION Sketch for 1x relay with buttons bistable. After back power all relays set OFF and send correct status OFF to controller. */ // Enable debug prints to serial monitor #define MY_DEBUG // Enable and select radio type attached #define MY_RADIO_NRF24 //#define MY_RADIO_RFM69 // Enabled repeater feature for this node #define MY_REPEATER_FEATURE #include <SPI.h> #include <MySensors.h> #include <Bounce2.h> // Define Relays #define RELAY_ON 1 // GPIO value to write to turn on attached relay #define RELAY_OFF 0 // GPIO value to write to turn off attached relay // Define Sensor ID's #define SSR_A_ID 1 // Id of the sensor child // Define buttons and relays const int buttonPinA = 3; const int relayPinA = 4; // Define Variables int oldValueA = 0; bool stateA = false; int trigger = 0; Bounce debouncerA = Bounce(); MyMessage msgA(SSR_A_ID, V_STATUS); void setup() { pinMode(buttonPinA, INPUT_PULLUP); // Setup the button Activate internal pull-up // After setting up the buttons, setup debouncer debouncerA.attach(buttonPinA); debouncerA.interval(5); // Make sure relays are off when starting up digitalWrite(relayPinA, RELAY_OFF); // Then set relay pins in output mode pinMode(relayPinA, OUTPUT); /*--------------------- Added these lines for toggle switch-------------------------*/ oldValueA = digitalRead(buttonPinA); // set oldValueA to the current status of the toggle switch // send(msgA.set(false)); // Send off state for relayA to ensure controller knows the switch is off // send(msgB.set(false)); // Send off state for relayB to ensure controller knows the switch is off } void presentation() { // Send the sketch version information to the gateway and Controller sendSketchInfo("Relay with Bistable", "1.1"); // Register all sensors to gw (they will be created as child devices) present(SSR_A_ID, S_LIGHT); } /* Example on how to asynchronously check for new messages from gw */ void loop() { if (trigger == 0){ send(msgA.set(false)); // Send off state for relayA to ensure controller knows the switch is off trigger = 1; } debouncerA.update(); // Get the update value int valueA = debouncerA.read(); if (valueA != oldValueA) { // send(msgA.set(stateA ? false : true), true); // Send new state and request ack back send(msgA.set(stateA ? false : true), false); // Send new state with no request for ack stateA = stateA ? false : true; // invert the state digitalWrite(relayPinA, stateA ? RELAY_ON : RELAY_OFF); // toggle the relay oldValueA = valueA; } } void receive(const MyMessage &message) { // We only expect one type of message from controller. But we better check anyway. if (message.type == V_STATUS) { switch (message.sensor) { case 1: stateA = message.getBool(); digitalWrite(message.sensor + 4, stateA ? RELAY_ON : RELAY_OFF); break; case 2: break; } // Write some debug info Serial.print("Incoming change for sensor:"); Serial.println(message.sensor); Serial.print("from node:"); Serial.println(message.sender); Serial.print(", New status: "); Serial.println(message.getBool()); } }
  • RFM69CW Continuous Mode

    2
    0 Votes
    2 Posts
    1k Views
    S
    Hello For answering to pins connection in continuous mode i think you can connect it to the pins you want, and poll or irq. But, RFM69 driver for Mysensors uses Packet Mode. not Continuous mode.
  • AC dimmer

    1
    0 Votes
    1 Posts
    712 Views
    No one has replied
  • 230V power supply to Arduino

    67
    3 Votes
    67 Posts
    76k Views
    crocC
    @axillent thanks and what is the smd coil that you use?
  • conecting the radio module on a MEGA 2560 ?? !!

    15
    0 Votes
    15 Posts
    5k Views
    H
    @samdel said: how do you measur the noisyness Empirically, I just couldn't get it working.
  • AC dimmer for 230v with smd relays

    2
    0 Votes
    2 Posts
    2k Views
    J
    Hello, Theese relays is already with triacs. You could look at themes in here: https://forum.mysensors.org/topic/4020/controlling-an-inductive-ac-load/2 ...and here: https://forum.mysensors.org/topic/3238/ac-light-dimmer-with-2x-triac There is discusion about it, and also shematics. Check it :)
  • RF433 transistor/fet wanted

    7
    0 Votes
    7 Posts
    2k Views
    Boots33B
    @ericvdb said: The problem is that when powered with 12V, the transmitter does not see the 5V on the data pin as high. Then maybe you can try on 9v as @TimO has suggested, this may be close enough to register the highs and still give you the range boost needed. Otherwise it would seem you will need some form of line level shift circuit as @dbemowsk has shown. The only other option would be a 5v transmitter like the Dorji or similar
  • PCBs for battery based sensor

    5
    2 Votes
    5 Posts
    3k Views
    ileneken3I
    @jumping Consider this: https://www.aliexpress.com/item/1PCS-TP5000-4-2V-3-6V-1A-Lithium-Battery-Charging-Board-Charger-Module/32756803176.html?ws_ab_test=searchweb0_0,searchweb201602_2_10065_10068_10084_10083_10080_10082_10081_10060_10061_10062_10056_10055_10037_10054_10033_10059_10032_10078_10079_10077_10073_10096_10070_10052_423_10050_424_10051,searchweb201603_2&btsid=e6d6960b-1c4d-48ce-b291-cde58e005c58 It's not as cheap as a TP4056, but it allows you to choose between battery technologies.
  • HC-SR501 motion sensor

    31
    0 Votes
    31 Posts
    37k Views
    abmantisA
    @mrwomble Yeah, the issue was probably due to the battery getting discharged during the OTA update, since that keeps the radio awake for a long time. So, should we use a 3.3V step up converter for this sensor?
  • Need lower voltage from powersupply

    2
    0 Votes
    2 Posts
    899 Views
    Boots33B
    @Tore-André-Rosander depending on how many leds you are running you could just put a diode in series with the supply, that will drop the voltage by about .5v which should still be ok. The diode will need to be able to handle the load of your leds though
  • In wall - PCB, (AC to DC 5v)

    pcb inwall
    89
    9 Votes
    89 Posts
    75k Views
    S
    @Ddawme - Hi! I suggest you read all the links in the project for example: http://forum.mysensors.org/topic/1607/safe-in-wall-ac-to-dc-transformers https://forum.mysensors.org/topic/4175/clearance-creepage-and-other-safety-aspects-in-mysensors-pcbs
  • Orange Pi Zero H2

    18
    0 Votes
    18 Posts
    8k Views
    D
    Here are 2 pics of my setup. The first pic is just of the Orange Pi and my gateway. The gateway is connected through one of the serial ports on the Orange Pi's GPIO pins. It can't be seen in the pic, but the top USB plug is for the external hard drive that has the OS on it. [image: controller_gateway_1.jpg] This pic includes my USB hub. The thing in slot 3 of the hub is my 1-Wire interface. The breadboard was from some things I had set up on my old R-Pi setup. May still hook up that RTC module, not sure yet. [image: controller_gateway_2.jpg]
  • Battery powered sensor last 1 week

    29
    0 Votes
    29 Posts
    10k Views
    B
    @sundberg84 Can I assume that you are using power to DHT22 via a FET or directly from Arduino pin, so you are controlling when the DHT22 is getting power/voltage? I personally think using a DHT22 that requires min 3.3 V is not a good option for battery device - but I understand it can be managed ;-) http://www.datasheetcafe.com/dht22-datasheet-pdf/ DHT22: [image: 1478973631527-dht22.png] My opinion is is use HTU21D instead since it can operate on a much lower battery voltage. Watch out, some breakout boards have a 3,3V voltage regulator, that is just using battery consumption and isn't needed when using Arduino 3.3V 1Mhz battery operated [image: 1478974582712-htu21d.png]
  • 9+A 5V power supply?

    9
    0 Votes
    9 Posts
    3k Views
    K
    Here are also some similar power supply and they ship really fast https://kutop.com/catalogsearch/result/?q=power+supply
  • RSSI and TX power of RFM69HW

    6
    0 Votes
    6 Posts
    4k Views
    fricklerF
    @scalz Thanks for the reply, that sounds great!
  • What is the best low frequency antenna I can get?

    6
    0 Votes
    6 Posts
    2k Views
    mfalkviddM
    @mk55 I have not seen any. https://www.adafruit.com/products/3077 has the radio module soldered on the same board as the mcu, but no sma.
  • 0 Votes
    2 Posts
    888 Views
    loiphinL
    No one have this problem?? Bueller... Bueller .... Bueller.... anyone?
  • What kind of sensor for my mailbox?

    7
    0 Votes
    7 Posts
    3k Views
    loiphinL
    http://www.ebay.com/itm/161806126324 I am going to use these magnetic switches on my postbox lid. Haven't got them yet, so cant say if they are any good or not.
  • Do I have to wire all grounds?

    2
    0 Votes
    2 Posts
    829 Views
    mfalkviddM
    @Chester one is enough. They are connected to each other on the pcb. You can verify this by putting a multimeter in continuity mode or resistance mode and measure the resistance between the two ground pads. The resistance should be zero.

10

Online

11.9k

Users

11.2k

Topics

113.4k

Posts