Skip to content

Hardware

1.8k Topics 18.4k Posts

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

  • Temp/Humidity/Light Sensor on battery

    3
    1 Votes
    3 Posts
    7k Views
    D
    @Dwalt actually the sketch is simple. #include <SPI.h> #include <MySensor.h> #include <DHT.h> #define CHILD_ID_HUM 0 #define CHILD_ID_TEMP 1 #define CHILD_ID_LIGHT 2 #define HUMIDITY_SENSOR_DIGITAL_PIN 4 #define BATTERY_SENSE_PIN A0 // select the input pin for the battery sense point #define LIGHT_SENSOR_ANALOG_PIN A1 unsigned long SLEEP_TIME = 60000; // Sleep time between reads (in milliseconds) MySensor gw; DHT dht; float lastTemp; float lastHum; boolean metric = true; MyMessage msgHum(CHILD_ID_HUM, V_HUM); MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP); MyMessage msg(CHILD_ID_LIGHT, V_LIGHT_LEVEL); int oldBatteryPcnt = 0; int battLoop =0; int lightLevel =0; int lastLightLevel =0; void setup() { gw.begin(NULL,15); dht.setup(HUMIDITY_SENSOR_DIGITAL_PIN); // Send the Sketch Version Information to the Gateway gw.sendSketchInfo("Temp Humidity Light", "1.0"); // Register all sensors to gw (they will be created as child devices) gw.present(CHILD_ID_HUM, S_HUM); gw.present(CHILD_ID_TEMP, S_TEMP); gw.present(CHILD_ID_LIGHT, S_LIGHT_LEVEL); metric = gw.getConfig().isMetric; check_batt(); } void loop() { delay(dht.getMinimumSamplingPeriod()); float temperature = dht.getTemperature(); if (isnan(temperature)) { Serial.println("Failed reading temperature from DHT"); } else if (temperature != lastTemp) { lastTemp = temperature; if (!metric) { temperature = dht.toFahrenheit(temperature); } gw.send(msgTemp.set(temperature, 1)); Serial.print("T: "); Serial.println(temperature); } float humidity = dht.getHumidity(); if (isnan(humidity)) { Serial.println("Failed reading humidity from DHT"); } else if (humidity != lastHum) { lastHum = humidity; gw.send(msgHum.set(humidity, 1)); Serial.print("H: "); Serial.println(humidity); } lightLevel = (analogRead(LIGHT_SENSOR_ANALOG_PIN))/10.23; if (lightLevel != lastLightLevel) { Serial.println(lightLevel); gw.send(msg.set(lightLevel)); lastLightLevel = lightLevel; } battLoop++; if (battLoop > 10) { check_batt(); battLoop=0; } gw.sleep(SLEEP_TIME); //sleep a bit } void check_batt() { // get the battery Voltage int sensorValue = analogRead(BATTERY_SENSE_PIN); Serial.println(sensorValue); // 1M, 470K divider across battery and using internal ADC ref of 1.1V // Sense point is bypassed with 0.1 uF cap to reduce noise at that point // ((1e6+470e3)/470e3)*1.1 = Vmax = 3.44 Volts // 3.44/1023 = Volts per bit = 0.003363075 // vout = (sensorvalue x 3.3) / 1023 //vin = vout / (R2/(R1+R2)); float batteryV = ( sensorValue * 0.003225806 ) / 0.3; // divide R2/(R1+R2) int batteryPcnt = sensorValue / 10 ; if ( batteryPcnt > 100 ) batteryPcnt = 100; Serial.print("Battery Voltage: "); Serial.print(batteryV); Serial.println(" V"); Serial.print("Battery percent: "); Serial.print(batteryPcnt); Serial.println(" %"); if (oldBatteryPcnt != batteryPcnt) { // Power up radio after sleep gw.sendBatteryLevel(batteryPcnt); oldBatteryPcnt = batteryPcnt; } } //```
  • MQTT gateway and freedomotic

    1
    0 Votes
    1 Posts
    1k Views
    No one has replied
  • Anyone using electronic transformers to power the nodes?

    7
    0 Votes
    7 Posts
    3k Views
    T
    It needs a minimum load onthe output, in order to function correctly. If this minimum requirement is not met, the output couod become unstable, and self oscillate. I've Seen this with an electronic transformer for halogen lights, where i use led lamps instead. Needed 1-2 halogen spots on it (it supplies 5 spots in total) in order for the electronic transformator to work correctly
  • Any suggestion to use arduino 328p internal temperature as ambient temp.

    2
    0 Votes
    2 Posts
    1k Views
    M
    @Dheeraj Personally I think it's interesting, but I also know it¨s been rejected in earlier discussions. It requires calibration, low-power and low activity arduino use. And even then, the accuracy isn't very impressive. I would still like to play a little and maybe use it as a complement in some projects. We'll see.
  • Decoupler capacitor

    4
    0 Votes
    4 Posts
    3k Views
    SweebeeS
    Thank you. And what about the low ESR capacitors?
  • Mini battery sensor

    battery micro sesnor
    3
    1 Votes
    3 Posts
    3k Views
    Ivan ZI
    Thank Sensor ready work. (I have not valid binary Optiboot) [image: 1427989664063-20150402_172032.jpg]
  • This topic is deleted!

    Locked
    4
    0 Votes
    4 Posts
    125 Views
  • Compact design relay with button

    9
    2 Votes
    9 Posts
    5k Views
    K
    @jendrush At the moment 5v use one of the [image: 1427712052724-20150330_160334.jpg]
  • Powering with LiPo a mini pro without regulator

    25
    0 Votes
    25 Posts
    17k Views
    A
    @m26872 This is mostly a matter of opinion. There are several options available. Personally, I will design so that I have three options to choose from depending on the sensor type (and long term measurement data)
  • USBTinyISP and arduino pro mini 3.3V

    3
    0 Votes
    3 Posts
    4k Views
    dakkyD
    this will work i think, but not sure what will happen, after removing the regulator from the pro (http://iot-playground.com/2-uncategorised/9-arduino-low-power-sensor). I hate it, that i don't find any useful documentation about my usbtiny grml :disappointed:
  • Newbie Gateway

    4
    0 Votes
    4 Posts
    2k Views
    M
    Yes, Nano is a bit bigger, but have own usb-serial chip so you can program it directly and have onboard 5-3.3 output. Keep forgetting that:) So if size is not an issue, got with the Nano...
  • FTDI Programer board

    5
    0 Votes
    5 Posts
    3k Views
    T
    @dakky No, it can not set fuses.. You need a ISP programmer for that. There are lot's of "cheap" isp programmers around, even an arduino can be made into a ISP programmer.
  • Security for mySensors

    xtea secure
    16
    0 Votes
    16 Posts
    14k Views
    D
    I don't know .. but ideally is if nrf24l01 set ack with payload .. and this payload will contain random number or rtc time .. encrypted with xtea . all node or repeater if receive ack then got this number or rtc time .. and use in next packet .. nrf24l01 chip can make 50%work alone .. node if send data packet then wait for hardware ack . and this ack can contain payload .. this payload will be starting point ..gw will generate actual payload for ack sequence .. It's just idea ..
  • MySensors power consumption

    battery powered
    23
    0 Votes
    23 Posts
    18k Views
    P
    Of cource it's powered down :-) - but is his done by a sw-command via SPI (and also the pwr-up) or by transistor ? I'm surprised about the quality of the rNF - the power down seems very good?
  • Distance sensor with Display

    2
    0 Votes
    2 Posts
    2k Views
    H
    Absolutely
  • Thermocoupler and MAX31855 calibration ?

    4
    0 Votes
    4 Posts
    3k Views
    M
    That lib only supports HW SPI(from what I can see) and I would need it for Pro Mini's. But tried it on a mega, almost same issue. Did some more testing with same result. I checked the datasheets , and from what I can see, it is depending on a stabel reference voltage. Was driving my pro mini with 5v and then regulating it to 3.3v for the MAX31855. So dataline was 5v and max31855 was 3.3. Even if this is within spec the macx31855 board I got was as cheap one, so it did not filter the voltage/data input for the chip.(Looks like the Adafruit board does?) Moving the regulator in front of it all, driving everything with 3.3v it's as stabel as could be expected. [image: 1426927325919-screenshot-2015-03-21-09.41.14.png] Green is a DS18B20, Blue a DHT21 and the black is the ThermoCoupler.
  • own sensors and devices

    1
    0 Votes
    1 Posts
    986 Views
    No one has replied
  • This topic is deleted!

    1
    0 Votes
    1 Posts
    322 Views
    No one has replied
  • antenna alignment

    5
    0 Votes
    5 Posts
    3k Views
    D
    If the sensor and the gateway are at the same level or about the same level I think using a half-wave dipole or "rubber duck" antenna pointed vertically is a good idea. That will focus the energy in the horizontal plane and not into the ground or to the air giving about 2 dBi of gain.
  • Pro Micro?

    3
    0 Votes
    3 Posts
    2k Views
    M
    It is possible to connect the radio, you can find instructions for example here. CE/CSN to any unised digital pin, IRQ not needed. However there are 2 pitfalls: voltage: You need to have 3.3v to power the radio. Pro Micro module is sold in 5V version or 3.3V version. 5V version don't have 3.3V pin output, so you have to arrange that by an external regulator. If you have 3.3V version, then it's fine for the radio, but such board is working on 8MHz, so it's not compatible with Leonardo target in Arduino IDE, you need to have hack that there. MCU there is different than Arduino Uno/Pro Mini, sleep modes are different; someone here reported that sleep is not working with MySensors, you can search here for experience with that. I made some helper PCBs for pro micro, you can check here. [image: upload-57ad0499-3d7e-4dfd-bfe1-b666f9b05fb8.jpg]

8

Online

11.9k

Users

11.2k

Topics

113.4k

Posts