Announcement

Collapse
No announcement yet.

Analog Input

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Analog Input

    Hi,

    I have a GEN4-IOD-24T.
    Brilliant bit of kit. Top marks to the design team.
    But I want to connect a temperature sensor to the analogue input of ESP8266.
    The schematic shows the pin as 'not connected' which means I am left with the tricky task of soldering a wire directly to the package pin!

    Next time you respin the board, could you add a little trace and a solder pad, just to make my life easier.
    And for an even better solution, add a potential divider so the input works to 3.3V

    This solder pad would be useful for any type of analogue sensor.

    Unless you have a bette ridea for connecting a temp.sensor?

    Ray

  • #2
    Hi Ray,

    Welcome to the forum and thank you for your comments.

    Sorry that the pin you want isn't available, it is only GPIO16 that is available. While GPIO16 isn't analogue capable it is possible to use this as a one-wire pin which allows you to connect a DS18b20 type sensor. We have developed a one-wire library specifically for GPIO16 on the IoD as the Arduino one-wire library isn't suitable for GPIO16

    Another option is to add an analog temp sensor to another ESP8226 module using the analog pin and then send the temperature to the IoD over Wifi.

    I will prepare some examples for the DS18b20 sensor with one-wire and do a thorough test

    Best regards

    Paul

    Comment


    • #3
      Hi Paul,

      DS18b20 is a very good idea. Thanks.
      But now I need to get to GPIO16!
      The Universal programmer is far too large to fit in the enclosure. Do you have a tiny breakout board?
      Or I can solder to one end of R5 which should be slightly easier than soldering to pin 6 of the ESP.

      Also where do I get your special One-Wire library?

      Ray

      Comment


      • #4
        Hi Ray,

        I have attached the one-wire library below. There is a DS18b20 example included in the library examples.

        It would be better to solder to the resistor R5. There are commercially available breakout boards that may help. This is a link to the type of things available but you may need to search for a suitable supplier

        https://www.aliexpress.com/i/32900726434.html

        Best regards

        Paul
        Attached Files

        Comment


        • #5
          Hi Paul,

          Thanks for the library.
          It doesn't compile!
          The problem is the prototype for the 'search' function in the .h file line number 319.
          What you have is this:
          uint8_t search(uint8_t *newAddr, bool search_mode = true);

          yet the function in the .cpp file is this:
          uint8_t search(uint8_t *newAddr);

          Make that change in the .h file and it compiles just fine.
          I can't tell it it actually works yet because the DS18b20 don't arrive until tomorrow )

          Ray

          Comment


          • #6
            Hi Ray,

            Thanks for letting me know, I am very sorry about that. I will also order a DS18b20 so I can give it a thorough test.

            Best regards

            Paul

            Comment


            • #7
              Hi Ray,

              I have attached the library that you should be using, Unfortunately the version I sent was incomplete but a more compatible version but still needs finishing. I will create a DS18b20 example for use with this library.

              Best regards

              Paul
              Attached Files

              Comment


              • #8
                Hi Paul,

                My DS18B20 devices arrived. Plugged one in with the OneWire library and the example sketch - all works perfectly. Very easy.
                Modified the example to use skip command because only 1 device on the bus and switch the config to 11 bits.

                Everything was smooth until I integrated it with my main application.
                Then I discovered the library interacts very badly with the AnalogWrite() function at low duty cycles.
                Lots of CRC errors. Maybe 9 in 10 reads from the sensor have CRC error. That is pretty much unusable!
                If I switch the AnalogWrite( ) frequency from 1KHz to 100Hz the CRC error rate improves hugely.

                I assume the problem is related to all the microsecond delays in the library, fighting with the realtime control in AnalogWrite().
                Maybe you could write a OneWire library that doesn't use delayMicrosecond().

                Ray

                Comment


                • #9
                  Hi Ray,

                  Thanks for the feedback. I will do some testing today and see if I can improve the library.

                  I will send you an update as soon as possible.

                  Best regards

                  Paul

                  Comment

                  Working...
                  X