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. Troubleshooting
  3. basic sensor on bare atmega328p not working

basic sensor on bare atmega328p not working

Scheduled Pinned Locked Moved Troubleshooting
5 Posts 2 Posters 1.5k Views 2 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.
  • M Offline
    M Offline
    MikaelK
    wrote on last edited by MikaelK
    #1

    Hello,

    I've recently begun building my first sensors. So far, I have an usb serial gateway talking with a humidity sensor (nano+dht22).

    My next step would be to build a sensor with the minimum components, and the first experimental step I've made almost works, but I get no value from the DHT22.

    My setup is :

    • breadboard with 3.3v power supply (YuRobot)
    • atmega328p running at 8Mhz on internal clock
    • nrf24L01+
    • DHT22 with data link tested on on 3 different digital pins
    • a led for debug purpose on digital pin 8
    • serial gateway plugged to a raspberry pi running domoticz
    • linux mint laptop with arduino IDE 1.6.7. Board is arduino Nano and upload is done with usbtinyISP 3.0

    The code is taken from HumiditySensor, slightly changed for debugging.

      if (isnan(temperature)) {
        Serial.println("Failed reading temperature from DHT");
        temperature = 0.0;
        gw.send(msgTemp.set(temperature, 1));
          
      } 
      else {
        lastTemp = temperature;
        gw.send(msgTemp.set(temperature, 1));
        Serial.print("T: ");
        Serial.println(temperature);
      }
    
    // same thing for humidity
    
      digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
      delay(500);       
      digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
      delay(500);               
    

    What happens is that the sensor is detected by the gateway and domoticz, but the readings are not numbers (see code above) and I get only zero on domoticz.
    I've swapped the DHT22 with the other working sensor : it works

    I've also tried with a DallasDS18B20 temp sensor and had a similar issue (I've not debbuged as much on that setup).

    I wonder if the programming should be done differently. I have tried adding a board definition taken from here : https://maniacbug.wordpress.com/2011/10/19/sensor-node/, but I may have bricked the chip as it does not anything anymore (no blinking led, no new value on domoticz), although the upload process works well.

    Would someone have an idea about what could be wrong with the setup ?

    Thanks in advance

    Mikael

    1 Reply Last reply
    0
    • hekH Offline
      hekH Offline
      hek
      Admin
      wrote on last edited by
      #2

      Might be a regression in master. So either switch to
      https://github.com/mysensors/Arduino/tree/development
      or back to
      https://github.com/mysensors/Arduino/releases/tag/1.5.1

      Until this is fixed.

      1 Reply Last reply
      0
      • M Offline
        M Offline
        MikaelK
        wrote on last edited by MikaelK
        #3

        Thanks for the tip.

        I reverted to 1.5.1 with a new atmega328p chip but it did not help, apart from the fact that the debug led now blinks and domoticz receives updated sendings with zeros.

        By the way, would anyone have a clue why my first atmega328p chip does not work even if it behaves well with avrdude and my isp ?

        Here is the output of avrdude : http://ur1.ca/ohh42

        When I burn a bootloader or upload a new sketch, I get no warning saying something goes wrong but my circuit does not work as with the new replacement chip.

        Regards

        Mikael

        edit : might have spoken too fast. I think I messed the revert to 1.5.1. I'll update soon.

        1 Reply Last reply
        0
        • M Offline
          M Offline
          MikaelK
          wrote on last edited by
          #4

          Ok, sorry for previous reply : the revert was the right solution. Thanks again !

          If someone has a clue about diagnosing the first atmega328p chip, I'd be glad to hear about that.

          Regards

          Mikael

          1 Reply Last reply
          0
          • M Offline
            M Offline
            MikaelK
            wrote on last edited by
            #5

            Hello,

            Two things :

            • first, the atmega chip was due to bad low fuse setting.

            • secondly, I had some luck when reverting to 1.5.1 and got a value on domoticz because the problem came back quickly. I tested my setup with 2 others ds18b20 temp sensors and it worked with only one of them. I checked again the DHT22 on my other sensor node (an arduino nano) and it works.

            It seems to me that my board has some issue, and one of those temp sensor is tolerant to it (I believe the other one works but I should check that). I Checked the voltage with my multimeter and it is 3.3v as it should. But I'm not experimented on electronics and I could have done some basic mistake.

            Would someone have any idea ?

            Regards
            Mikael

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


            19

            Online

            11.7k

            Users

            11.2k

            Topics

            113.1k

            Posts


            Copyright 2025 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