Skip to content
  • MySensors
  • 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
  1. Home
  2. My Project
  3. Small wall outlet sensor node

Small wall outlet sensor node

Scheduled Pinned Locked Moved My Project
40 Posts 17 Posters 24.0k Views 12 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • axillentA Offline
    axillentA Offline
    axillent
    Mod
    wrote on last edited by
    #20

    made two more with modified box - it is a bit wider to hold DHT sensor inside
    I made a new sketch as a combination of Dalas example and DHT. This new sketch able to detect automatically connected sensors and work according to detection.

    One problem I've got. I cannot get DHT working from AC plug. It is working fine been powered from DC and failed during startup been powered from AC :( The most probably the reason is high pulsation (up to 440mV) coming from the supply based on SR10 chip.
    Dalas is fine with this but not DHT. Probably some code inside the library holds.

    Had to mark each sensor with radio channel because they will work with different gateways
    IMG_2144.JPG

    sense and drive

    1 Reply Last reply
    0
    • S Offline
      S Offline
      sharath krishna
      wrote on last edited by
      #21

      really cool :) what are u using to convert the AC-DC ? how u doing it ?

      axillentA J 2 Replies Last reply
      0
      • S sharath krishna

        really cool :) what are u using to convert the AC-DC ? how u doing it ?

        axillentA Offline
        axillentA Offline
        axillent
        Mod
        wrote on last edited by
        #22

        @sharath-krishna thanks

        yearly in this thread you can find a schematics.
        I'm using here SR10. Many alternatives were discussed here http://forum.mysensors.org/topic/687/230v-power-supply-to-arduino

        I've found a solution to my problem with DHT. I put delay(500) at the beginning of setup().
        This is needed to stabilize DC before initializing DHT.
        Alternatively a 4.7uF capacitor can be connected between RESET and GND

        sense and drive

        1 Reply Last reply
        0
        • axillentA Offline
          axillentA Offline
          axillent
          Mod
          wrote on last edited by
          #23

          This is my combined sketch with automatic detection of connected many DS18B20 and DHT11/22

          #define RADIO_CHANNEL		76
          
          #define DS18B20_PIN			A0
          #define DS18B20_MAX_SENSORS	8
          #define DHT_PIN				A5
          #define LED_PIN				5
          #define SLEEP_TIME_SEC		60
          
          #include <avr/wdt.h>
          #include <avr/interrupt.h>
          #include <avr/sleep.h>
          
          #include <MySensor.h>
          #include <SPI.h>
          #include <DallasTemperature.h>
          #include <OneWire.h>
          #include <DHT.h>
          
          // DS18B20
          OneWire oneWire(DS18B20_PIN);
          DallasTemperature	sensors(&oneWire);
          
          MyMessage msgHum(0, V_HUM);
          MyMessage msgTemp(0, V_TEMP);
          
          struct {
          	struct {
          		uint8_t	count;
          		float	lastTemperature[DS18B20_MAX_SENSORS];	
          	} ds18b20;
          	struct {
          		DHT		sensor;
          		uint8_t	count;
          		float lastTemp;
          		float lastHum;
          	} dht;
          	MySensor gw;
          } var;
          
          ISR(WDT_vect) {
          }
          
          void setup()
          {
          	wdt_disable();
          	//delay(500);
          
          	pinMode(LED_PIN, OUTPUT);
          	digitalWrite(LED_PIN, HIGH);
          
          	// init mysensors
          	var.gw.begin(NULL, AUTO, false, AUTO, RF24_PA_LEVEL,RADIO_CHANNEL);
          
          	// init dalas
          	sensors.begin();
          	var.ds18b20.count = sensors.getDeviceCount();
          	if(var.ds18b20.count > DS18B20_MAX_SENSORS) var.ds18b20.count = DS18B20_MAX_SENSORS;
          
          	// init dht
          	digitalWrite(LED_PIN, LOW);
          	var.dht.sensor.setup(DHT_PIN);
          	float temperature = var.dht.sensor.getTemperature();
          	var.dht.count = (isnan(temperature))?0:1; 
          
          	var.gw.sendSketchInfo("WallCombined", "1.0");
          
          	// present ds18b20
          	for (int i=0; i<var.ds18b20.count; i++) {
          		var.gw.present(i+2, S_TEMP);
          	}
          	if(var.dht.count) {
          		var.gw.present(0, S_HUM);
          		var.gw.present(1, S_TEMP);		
          	}
          	var.gw.debugPrint(PSTR("Init of combined sensor: %d ds18b20 sensors, %d dht sensors\n"), var.ds18b20.count, var.dht.count);
          	for(int i=0; i < var.ds18b20.count + var.dht.count; i++) {
          		digitalWrite(LED_PIN, LOW);
          		delay(500);
          		digitalWrite(LED_PIN, HIGH);
          		delay(1000);
          	}
          }
          
          void loop()
          {
          	// Process incoming messages (like config from server)
          	var.gw.process();
          
          	// Fetch temperatures from Dallas sensors
          	if(var.ds18b20.count) sensors.requestTemperatures();
          
          	// Read temperatures and send them to controller
          	for (int i=0; i<var.ds18b20.count; i++) {
            
          		// Fetch and round temperature to one decimal
          		float temperature = static_cast<float>(static_cast<int>((var.gw.getConfig().isMetric?sensors.getTempCByIndex(i):sensors.getTempFByIndex(i)) * 10.)) / 10.;
            
          		// Only send data if temperature has changed and no error
          		if (var.ds18b20.lastTemperature[i] != temperature && temperature != -127.00) {
          	  
          			// Send in the new temperature
          			var.gw.send(msgTemp.setSensor(i+2).set(temperature,1));
          			var.ds18b20.lastTemperature[i]=temperature;
          		}
          	}
          
          	if(var.dht.count) {
          		boolean metric = var.gw.getConfig().isMetric;
          		float temperature = var.dht.sensor.getTemperature();
          	
          		if (isnan(temperature)) {
          			var.gw.debugPrint(PSTR("Failed reading temperature from DHT\n"));
          		} else if (temperature != var.dht.lastTemp) {
          			var.dht.lastTemp = temperature;
          			if (!metric) {
          				temperature = var.dht.sensor.toFahrenheit(temperature);
          			}
          			var.gw.send(msgTemp.setSensor(1).set(temperature, 1));
          		}
          
          		float humidity = var.dht.sensor.getHumidity();
          		if (isnan(humidity)) {
          			var.gw.debugPrint(PSTR("Failed reading humidity from DHT"));
          		} else if (humidity != var.dht.lastHum) {
          			var.dht.lastHum = humidity;
          			var.gw.send(msgHum.setSensor(0).set(humidity, 1));
          		}
          	}
          
          	digitalWrite(LED_PIN, HIGH);
          	delay(5000);
          	digitalWrite(LED_PIN, LOW);
          	delay(500);
          
          	// sleep
          	Serial.flush();
          	var.gw.powerDown();
          
          	for(int wdt_count=SLEEP_TIME_SEC; wdt_count > 0; wdt_count--) {
          		wdt_enable(WDTO_1S);
          		WDTCSR |= (1 << WDIE);
          		set_sleep_mode(SLEEP_MODE_PWR_DOWN);
          		sleep_enable();
          		sei();
          		sleep_cpu();
          		sleep_disable();
          	}
          
          	wdt_disable();
          }
          

          sense and drive

          1 Reply Last reply
          0
          • axillentA Offline
            axillentA Offline
            axillent
            Mod
            wrote on last edited by
            #24

            3D models are published here http://www.thingiverse.com/thing:688442

            sense and drive

            BulldogLowellB 1 Reply Last reply
            0
            • axillentA axillent

              3D models are published here http://www.thingiverse.com/thing:688442

              BulldogLowellB Offline
              BulldogLowellB Offline
              BulldogLowell
              Contest Winner
              wrote on last edited by
              #25

              @axillent said:

              3D models are published here http://www.thingiverse.com/thing:688442

              nice job

              can you tell us what kind of 3D printer you are using, and if you are happy with it.

              I have a lot of electronics, and not a lot of housings.... I'm thinking about jumping in!

              axillentA 1 Reply Last reply
              0
              • BulldogLowellB BulldogLowell

                @axillent said:

                3D models are published here http://www.thingiverse.com/thing:688442

                nice job

                can you tell us what kind of 3D printer you are using, and if you are happy with it.

                I have a lot of electronics, and not a lot of housings.... I'm thinking about jumping in!

                axillentA Offline
                axillentA Offline
                axillent
                Mod
                wrote on last edited by
                #26

                @BulldogLowell I'm using Makerbot Replicator 2 for more than 2 years

                I have nothing to compare with. But it gives the possibilities I never have.
                From hardware side I had to fix some problems Replicator 2 is having. New models I hope is more sufficient.
                Makerbot is progressing, at least an improvement on software side is essential.

                Today you will find many brands and many models to choose from.

                sense and drive

                1 Reply Last reply
                0
                • S sharath krishna

                  really cool :) what are u using to convert the AC-DC ? how u doing it ?

                  J Offline
                  J Offline
                  Jan Gatzke
                  wrote on last edited by
                  #27

                  @axillent How do you upload the sketch? Do you solder in a preprogrammed atmega or are there connectors on the board? The DHT needs only 1.5 mA. Wouldn't it be possible to supply this with an digital out pin of the atmega? This way you could delay the power up process.

                  axillentA 2 Replies Last reply
                  0
                  • bjornhallbergB Offline
                    bjornhallbergB Offline
                    bjornhallberg
                    Hero Member
                    wrote on last edited by
                    #28

                    Just a fair warning for anyone considering a new ("5th generation") Makerbot Replicator. Check up on some reviews before getting one. Things have apparently gone downhill since the good old days. Extruders don't last as long etc. If anyone is willing to pay the sort of price that Makerbot is asking there are better alternatives.
                    http://nicklievendag.com/makerbot-replicator-5th-generation-review/

                    Also, the Makerbot software is painfully slow compared to most alternatives.
                    http://nicklievendag.com/simplify3d-vs-makerbot-desktop/
                    http://www.fabbaloo.com/blog/2014/7/20/hands-on-with-simplify3d
                    Not that I endorse Simplify3D. There are free / open-source alternatives that are just as fast.

                    Finally, I'm skeptical about the legal details surrounding Thingiverse.

                    1 Reply Last reply
                    0
                    • J Jan Gatzke

                      @axillent How do you upload the sketch? Do you solder in a preprogrammed atmega or are there connectors on the board? The DHT needs only 1.5 mA. Wouldn't it be possible to supply this with an digital out pin of the atmega? This way you could delay the power up process.

                      axillentA Offline
                      axillentA Offline
                      axillent
                      Mod
                      wrote on last edited by axillent
                      #29

                      @Jan-Gatzke originally a pre-loaded MCU were soldered but later I solder on top of the PCB a 6 pin ISP connectors
                      There is no need to source DHT from the MCU pin, it is simple to put delay at the beginning of setup or use highest startup time by fuses (my choice)

                      the original idea is to use pogopin connector, but I've just ordered them and not yet received. I need a very small footprint ISP connector for Mysensors devices

                      @bjornhallberg said:

                      Just a fair warning for anyone considering a new ("5th generation") Makerbot Replicator. Check up on some reviews before getting one.

                      have no experience with 5th generation but fully agree with you that there are many alternatives

                      Also, the Makerbot software is painfully slow compared to most alternatives.

                      it is not true. I'm very satisfied with the performance of the software.
                      I do not believe that someone can be faster than instantaneous

                      Finally, I'm skeptical about the legal details surrounding Thingiverse.

                      what kind of issues?

                      sense and drive

                      bjornhallbergB 1 Reply Last reply
                      0
                      • axillentA axillent

                        @Jan-Gatzke originally a pre-loaded MCU were soldered but later I solder on top of the PCB a 6 pin ISP connectors
                        There is no need to source DHT from the MCU pin, it is simple to put delay at the beginning of setup or use highest startup time by fuses (my choice)

                        the original idea is to use pogopin connector, but I've just ordered them and not yet received. I need a very small footprint ISP connector for Mysensors devices

                        @bjornhallberg said:

                        Just a fair warning for anyone considering a new ("5th generation") Makerbot Replicator. Check up on some reviews before getting one.

                        have no experience with 5th generation but fully agree with you that there are many alternatives

                        Also, the Makerbot software is painfully slow compared to most alternatives.

                        it is not true. I'm very satisfied with the performance of the software.
                        I do not believe that someone can be faster than instantaneous

                        Finally, I'm skeptical about the legal details surrounding Thingiverse.

                        what kind of issues?

                        bjornhallbergB Offline
                        bjornhallbergB Offline
                        bjornhallberg
                        Hero Member
                        wrote on last edited by
                        #30

                        @axillent said:

                        Also, the Makerbot software is painfully slow compared to most alternatives.

                        it is not true. I'm very satisfied with the performance of the software.
                        I do not believe that someone can be faster than instantaneous

                        I meant slicing speeds on very complex models specifically. But it would not surprise me if the print quality / toolpaths created are better with competing software as well.

                        Finally, I'm skeptical about the legal details surrounding Thingiverse.

                        what kind of issues?

                        Like Facebook and other big corporations where they basically own the data you upload and store on their servers.

                        Oh, also, bonus points to Makerbot / Stratasys for actually stealing technology and incorporating it into their own designs:
                        http://3dprintingindustry.com/2014/05/28/makerbot-become-takerbot/

                        Bottom line, your Replicator 2 is in many ways better than the current line-up from Makerbot. Mostly because the extruder will last you many thousands of hours and not just 200-500 or whatever they guarantee these days when people come complaining.

                        The biggest joke is perhaps their massive Z18 printer, which costs a fortune, puts out dismal results (at least without a ton of tweaking if at all possible), can't handle ABS and is really slow. Plus having the same lousy extruder. I mean, 200 hours on the Z18 could translate into just 10 reasonably big print jobs. They actually got one at my local Makerspace. :dizzy_face: They could have gotten two ordinary printers for the price of that one ...

                        axillentA 1 Reply Last reply
                        0
                        • bjornhallbergB bjornhallberg

                          @axillent said:

                          Also, the Makerbot software is painfully slow compared to most alternatives.

                          it is not true. I'm very satisfied with the performance of the software.
                          I do not believe that someone can be faster than instantaneous

                          I meant slicing speeds on very complex models specifically. But it would not surprise me if the print quality / toolpaths created are better with competing software as well.

                          Finally, I'm skeptical about the legal details surrounding Thingiverse.

                          what kind of issues?

                          Like Facebook and other big corporations where they basically own the data you upload and store on their servers.

                          Oh, also, bonus points to Makerbot / Stratasys for actually stealing technology and incorporating it into their own designs:
                          http://3dprintingindustry.com/2014/05/28/makerbot-become-takerbot/

                          Bottom line, your Replicator 2 is in many ways better than the current line-up from Makerbot. Mostly because the extruder will last you many thousands of hours and not just 200-500 or whatever they guarantee these days when people come complaining.

                          The biggest joke is perhaps their massive Z18 printer, which costs a fortune, puts out dismal results (at least without a ton of tweaking if at all possible), can't handle ABS and is really slow. Plus having the same lousy extruder. I mean, 200 hours on the Z18 could translate into just 10 reasonably big print jobs. They actually got one at my local Makerspace. :dizzy_face: They could have gotten two ordinary printers for the price of that one ...

                          axillentA Offline
                          axillentA Offline
                          axillent
                          Mod
                          wrote on last edited by axillent
                          #31

                          @bjornhallberg bad to know that new models are worse

                          actually had no plans to upgrade. For the nearest feature I'm fine with Repl2.
                          it is also important that I made a required tuning and able to recover many things by myself
                          already have an experience and know what to expect

                          I do not think my models complicated but the slicing speed was improved by handred times in the first year of the purchase
                          today i have to wait almost none before printing starts

                          what is even more important - raft support was improved revolutionary. Before it was sucks to print surface on the raft - it became ugly and unacceptable as a from panel. Now all are very different

                          sense and drive

                          1 Reply Last reply
                          0
                          • Johnny B GoodJ Offline
                            Johnny B GoodJ Offline
                            Johnny B Good
                            wrote on last edited by
                            #32

                            Great project axillent +1

                            -= GreetingZzz and may the sensors be with you =-

                            axillentA 1 Reply Last reply
                            0
                            • Johnny B GoodJ Johnny B Good

                              Great project axillent +1

                              axillentA Offline
                              axillentA Offline
                              axillent
                              Mod
                              wrote on last edited by
                              #33

                              @Johnny-B-Good thanks!

                              sense and drive

                              D 1 Reply Last reply
                              1
                              • axillentA axillent

                                @Johnny-B-Good thanks!

                                D Offline
                                D Offline
                                Dheeraj
                                Plugin Developer
                                wrote on last edited by
                                #34

                                @axillent

                                very nice

                                1 Reply Last reply
                                0
                                • J Jan Gatzke

                                  @axillent How do you upload the sketch? Do you solder in a preprogrammed atmega or are there connectors on the board? The DHT needs only 1.5 mA. Wouldn't it be possible to supply this with an digital out pin of the atmega? This way you could delay the power up process.

                                  axillentA Offline
                                  axillentA Offline
                                  axillent
                                  Mod
                                  wrote on last edited by
                                  #35

                                  @Jan-Gatzke said:

                                  @axillent How do you upload the sketch?

                                  do you mean a .zip file or the inline source?
                                  for inline I have to add leading spaces to all lines (it is simple to to in Atmel Studio) and than just past it here

                                  sense and drive

                                  1 Reply Last reply
                                  0
                                  • S Offline
                                    S Offline
                                    sharath krishna
                                    wrote on last edited by
                                    #36

                                    @axillent i wanted some more information along with the schematics.. like the wattage of the resistors used and also the type and voltage rating of the capacitors . Please could you provide the same ?

                                    axillentA 1 Reply Last reply
                                    0
                                    • S sharath krishna

                                      @axillent i wanted some more information along with the schematics.. like the wattage of the resistors used and also the type and voltage rating of the capacitors . Please could you provide the same ?

                                      axillentA Offline
                                      axillentA Offline
                                      axillent
                                      Mod
                                      wrote on last edited by
                                      #37

                                      @sharath-krishna no problem

                                      all resistors except R4 & R5 are SMD 0603, R4 & R5 are SMD 1206
                                      C8 is 0.47-0.68uF @ 400V for 220V input, or 0.68-1uF @ 250V for 110V

                                      all other capacitors need a rate for 10V and above

                                      sense and drive

                                      T 1 Reply Last reply
                                      0
                                      • axillentA axillent

                                        @sharath-krishna no problem

                                        all resistors except R4 & R5 are SMD 0603, R4 & R5 are SMD 1206
                                        C8 is 0.47-0.68uF @ 400V for 220V input, or 0.68-1uF @ 250V for 110V

                                        all other capacitors need a rate for 10V and above

                                        T Offline
                                        T Offline
                                        Tibus
                                        wrote on last edited by
                                        #38

                                        @axillent thanks for the values but what are the wattage of the resistors?

                                        axillentA 1 Reply Last reply
                                        0
                                        • S Offline
                                          S Offline
                                          sharath krishna
                                          wrote on last edited by
                                          #39

                                          @axillent : thanks :+1: and @Tibus i think all only 45 and r4 would be like 0.5w else all 0.25 may be :) i have not worked much with smd tough.

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          9

                                          Online

                                          11.7k

                                          Users

                                          11.2k

                                          Topics

                                          113.0k

                                          Posts


                                          Copyright 2019 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                                          • Login

                                          • Don't have an account? Register

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