Jump to content
  • entries
    6
  • comments
    97
  • views
    13,800

DIY - External Temperature and Humidity Sensor - AVCS-DHT1 Build Guide


=VG= SemlerPDX

4,157 views

image.png

I have written a new voice control profile called 'AVCS SENS' for VoiceAttack specifically dealing with sensors and weather commands.  I wanted to use the Shared Memory feature of the AIDA64 Extreme sensor monitoring program to enable my VoiceAttack profile to speak the requested computer sensor value when asked over text-to-speech.

Once I had sensor values from AIDA64 Extreme in VoiceAttack, I then added a DHT11 Temperature & Humidity sensor to the Arduino Uno on my prototype breadboard, connected to my PC through USB.  Now reading this as well from my VoiceAttack profile, I could do a little math to get a more absolute and objective value from the computer sensors, a CPU temperature in "degrees over ambient", for example, or "delta-T over ambient" as you may hear it called in analysis videos such as this one here talking about case testing methodology used by Gamers NexusThis is the true means to understand what computer sensors for temperature are reporting at any given time, by first accounting for the temperature of the room.

Finally, with this relative sensor data now available, I've been able to write a simple diagnostic algorithm which can identify & flag atypical sensor values, as compared to stored baseline values on file, for voice commands in VoiceAttack.  Without an AVCS-DHT1, outdoor weather and sensor report commands are still available, yet indoor weather & sensor diagnostic commands will be unavailable.  I wanted to make it possible for anyone using my new AVCS SENS profile for VoiceAttack to either be able build their own AVCS-DHT1 USB external temperature & humidity sensor,
or buy one designed & built by me, according to this simple Arduino project build guide, and therefore unlock these additional voice command features for AVCS SENS.

 


My DIY USB Temperature & Humidity Sensor 'AVCS-DHT1' - for use in my AVCS Voice Sensors & Weather Profile
parts list below contains links to specific items which I directly purchased myself for this project on Amazon only, but any store will do, and also any equivalent part which performs the same will work (brand names/quantities do not matter!)
if you are using a different case than the exact one linked below, or other components, please see the note in the AVCS SENS Wiki page regarding Sensor Calibration

 

image.png

Project Required Parts List                                                    
(all prices listed in USD - price and availability may be different past last publish date of this guide)
 

Arduino Nano (or equivalent clone) - with NO header pins soldered on!
(HiLetgo Nano v3.0 5V) (3 pack)  -  $24.49
https://www.amazon.com/dp/B01DLIJQA2
$8.16 per board

USB Cable - USB 2.0 Type A to Mini-B (3ft. or 1 meter, at least)  (or equivalent part)
(iSeekerKit Nylon Braided 3ft.) (3 pack)  -  $8.99
https://www.amazon.com/dp/B08LL272SK
$3.00 per cable

DHT11 Temperature Humidity Sensor Module 3.3V-5V (or DHT22, or equivalent part)
(HiLetgo w/Dupont Wires) (5 pack)  -  $10.29
https://www.amazon.com/dp/B01DKC2GQ0
$2.06 per sensor

Plastic Electronics Project Case @ 1.97" x 1.10" x 0.59" (50mm x 28mm x 15mm)
(Zulkit ABS Project Boxes) (5 pack)  -  $7.99
https://www.amazon.com/dp/B07PZ24LFD
$1.60 per item

Metal Film Fixed Resistor 10K ohm (0.5Watt) - just one will be needed
(EDGELEC Pack of Resistors) (100 pack)  -  $5.99
https://www.amazon.com/dp/B07QJB31M7
$0.06 per resistor

Strong Double-Sided Foam Adhesive Tape (or equivalent product) - only need a few inches
(Gorilla Brand Heavy Duty Mounting Tape) (1" x 120" roll)  -  $11.34
https://www.amazon.com/dp/B082TQ3KB5
$0.20 approx. amount used

Neodymium Magnet 8mm x 2mm (round, size is important!) - just one will be needed
(FINDMAG Box of Magnets) (100 pack)  -  $9.99
https://www.amazon.com/dp/B09BB1VT4J
$0.10 per magnet

Total:
$15.18 (USD)  (for 1 sensor*) - (total if all parts purchased with amounts above:  $79.08)
*(also required - drill/rotary tool, solder and soldering iron, electrical tape, tweezers, scissors, 'nippers', 'spudger' type tool, and SuperGlue)

This project requires the following skills & knowledge:

  • Basic understanding of Arduino (what it is/what it does)
  • Basic experience with electrical soldering
  • Basic skills with drill or Dremel/rotary tool and bits
  • Use of and precautions relating to SuperGlue type adhesive
  • Ability to make precise cuts with scissors within 1-2mm
  • Ability to carefully follow instructions (some are crucial)
  • Entry level experience with VoiceAttack (import profile, etc.)
  • Ability to work w/ tiny parts in a small space in timely manner
  • A positive attitude and willingness to adapt and overcome (not exactly required, but always recommended ;) )
     

Part 1 - Preparing the Sensor                                              

image.png

preparing the DHT sensor and stripping the braided wires - image a1

1. Separate the DHT11 (or DHT22) from the breakout board it is mounted on (if not supplied without one).  Either snip the wires from the DHT as close to the board as possible with "nippers" (image a1), or de-solder them from the breakout board.  If supplied with the Dupont ribbon wires, remove the plastic ends and prepare the wire ends by cutting them even and strip the wires leaving at least 1.5cm bare.  We want around 75-100mm (2.95-3.93") of flexible braided wire so we can zig-zag the excess, allowing us to remove the plastic lid with sensor and not risk yanking the soldered wires out.

image.png

solder wire ends - image a2

2. Twist the wire ends and tint them with solder to make them stiff, yet not so much as to increase their width with too much solder & slag - three of them must fit through the holes on the Arduino.

 

 

3. Once the DHT has been separated from the breakout board, with the side with holes facing you and pins down, cut the third pin from the left, or second from the right, as in image a1.

image.png

gently bending the pins, resistor legs, and wires - image a4

4. Prepare the DHT pins by gently curving them into hooks facing away from the side of the sensor with holes.  Gently bend the legs of the 10K ohm resistor (as shown in image a4) so that it will sit in the hooks of the two DHT pins closest together, as seen with the sensor face down (holes down, as in image a5).

 

image.png

resistor placement - image a5

5. Bend two of the three wire ends away laterally away from the third wire, into a gentle hook shape, and the third wire opposite those in the same manner. Lay the 10K ohm resistor into the right two wire-hooks of the DHT sensor (face down - image a5).

image.png

 final goal for the resistor, legs, and wires: flat & straight - image a3


NOTE: The Resistor should be offset in a manner where its bulk and width can mostly lay flat along side the wires and not on top of them once completed (image a3).

 

 

image.png

gently crimping the DHT pins around resistor legs & wires - image a6

6. Lay the wire "hooks" into their corresponding DHT wire "hooks" over the resistor, and if able, use a tweezers to gently compress these DHT wire hooks to contain the wires and resistor for soldering, as well as the wire "hooks" themselves.  If this is not possible, you may want to secure the DHT to the table with scotch tape, lay the three wires in place in their "hooks", and scotch tape down the wires to the table with a gentle pull, to ensure they remain in place while soldering them firmly in place as one connection. 

 

image.png

soldering to the DHT - image a7

7. Solder each connection so that the wire, the wire "hook" from the DHT, and the resistor are fully encased, and not touching each other.

image.png

trimming legs from resistor, and any protruding slag - image a8

8. When cooled, use "nippers" to nip any protruding slag or wire ends, and the trailing legs of the resistor as it exits the solder as in image a8.  The wires should travel flat following the rear plane of the sensor, so that later, the front face of the sensor (with holes) can protrude out of a hole we will cut in the case lid.  Refer to images a3 and a8 to see the resistor in-line with wires, as an example.

image.png

wrap wires separately - image a9

9. Finally, wrap each exposed solder point with a separate small piece of electrical tape to ensure each cannot bridge contact with another in the event that something gets bent.  Just sandwiching a small rectangle of tape over each one will do, even if each has a tail of tape hanging off.  These bits of tape will be covered and held in place permanently once the sensor is mounted into the lid later.

 

 

SAFETY SAVES LIVES - SAFETY GOGGLES SAVE EYES!  BE SMART AND USE APPROPRIATE SAFETY GEAR WHILE WORKING!

 

Part 2 - Preparing the Case                                                  

Step-8a-1.png

drill 12 tiny air holes - image b1

1. Carefully remove the lid from the case - while holding the base in one hand, lid up, with the notch in the lid away from you, use a fingernail in the notch along with pressure from your finger to pry that side of the lid upwards.  If using a tool, be careful not to use too much pressure or the soft ABS plastic may deform or scratch if the tool jumps too fast once the lid becomes free.

image.png

keep notch at bottom - image b2

2. For the lid, we want to create a rectangular hole that will allow the front face of the DHT sensor to protrude.  The tapered sides of the blue sensor case widen towards its back which will keep it from protruding farther.  The lid is 25.9mm wide & 47.75mm tall.  The approximate width of the hole will be at or under 16mm tall and 12.60mm wide.  For this to work well, it is best to cut a slightly smaller hole than desired and slowly widen it with hand tools or low speed rotary tool - stopping and testing the fit until just right (as shown in image b6 below).  It is not easy to get exact, I've tried.  Just accept any slight tilt, it is a DIY after all.

image.pngport is upside down - image b3

The goal for the USB hole is to make it flush with the bottom of the case as it exits, and as wide as the USB port itself (8mm).  The port is 4mm tall, but as you can see in image b3, even I could not quite keep that height with that limit as I drilled and widened the hole.  Again, stop and check the fit - first dusting out any bits of plastic from the process, and sliding the Arduino Nano upside down as shown for a test fit.  It must slide flat with the case bottom and through the case wall as shown.

 

3. With the lid removed from the base, use a drill bit between 1mm-2mm at low speed to create 4 holes in the 'top', and 4 holes on each side near the top (as shown in image b1), for 12 total air holes.  The passthrough hole for the USB mini-B port will require drilling and widening with hand tools or a rotary tool at a low speed.  The port is about 4mm tall & 8mm wide.  High speeds may heat and melt the ABS plastic, so if you are working at an area for too long, back off and let it cool down.
 

image.png

place one small drop of SuperGlue at the arrow for magnet - image b4

4. Once all the holes are drilled and the rough edges cleaned up as much as possible, wipe the interior clean of plastic dust.  Using a strong SuperGlue, place a very small drop inside the case at the top near the four holes you drilled, as shown by the arrow in image b4.  Carefully place the tiny magnet over the drop of glue; non-magnetic tip tweezers or even chopsticks can really help - just be sure not to touch the SuperGlue as you position the magnet.

image.png

 test fit the sensor into lid - image b6

 

5. Finally, cut a strip of the double-sided adhesive foam tape about 25mm wide and 8mm tall - do not remove the backing yet!  Once the SuperGlue has dried (give it a few minutes) place the strip of tape over the magnet (image b5, below).

 

image.png

fully cover magnet with tape, do not remove backing (yet) - image b5

Part 3 - Preparing the Arduino                                           

image.png

setting the board to "Arduino Nano" and its COM Port - image c1

1. Open the Arduino IDE v1.8 (latest) (download and install first, if not already done) and make sure it is updated to current release version.  Place the Arduino Nano on a hard, non-conductive surface, and connect the USB cable to the device and then to the PC.  Refer to device instructions (per brand/model/type) as required, if the device driver is not installed automatically.  Under the 'Tools' Menu along the top, select the COM Port of this device, and set the board to Arduino Nano (as shown in image c1), and unless directed by device instructions, leave the Processor as "ATmega328P".

image.png

opening and uploading the Arduino Basics "Blink" sketch - image c2

2. Under the 'File' Menu along the top, select Examples > Basics > Blink to open this sketch (see image c2).  Next, click the Upload button ( image.png ) to send this sketch to the Arduino Nano.  Verify that the onboard LED slowly blinks on and off repeatedly to ensure this board is functioning, and that sketches are uploading properly.  If you have any problems at this stage, you will want to stop and perform other troubleshooting steps to verify that the Arduino IDE is set up properly to communicate with this board, and that the board itself is not faulty.  See Addendum at the bottom of this guide for help.

 

 

image.png

installing or updating the "Adafruit Unified Sensor" library - image c3

3. To get data from the DHT sensor, we will be using an open source DHT Sensor Library by Adafruit, which requires the Adafruit Unified Sensor Library, as well.  In the Arduino IDE, under the 'Tools' Menu, select 'Manage Libraries...' (or press CTRL+i) to open this window - it takes a few seconds to open.  First, select the Type of "All" (if not already selected), and the Topic of "Sensors".  In the search field, type "Adafruit Unified Sensor".  The list will be long, scroll down until you find the Adafruit Unified Sensor library (as pictured in image c3) - install it or update with the latest version, if not already.

image.png

installing or updating the Adafruit "DHT sensor library" - image c4

4. Next, in that same search field, type "DHT sensor library".  Again, the list will be long, scroll down until you find the item with the title "DHT sensor library" by Adafruit (as pictured in image c4) - again, install or update it if it is not installed with the latest version.

When you are finished, close the Library Manager and disconnect the Arduino from the computer.

If desired, use a light grit sandpaper on the edges of the Arduino Nano PCB board to make them smooth.

image.png

 AVCS-DHT1 Wiring Diagram (your resistor color may be different!)  -  image c5

5. Once you have verified that the Blink sketch is working from earlier steps, and that the Arduino IDE can properly upload to the Arduino Nano board, it's time to solder the wires from the DHT sensor to the Arduino.  Follow the wiring diagram (shown in image c5), separating the ribbon cable to individual wires for flexibility, as needed.

 

image.png

later, mounting will be upside down, as shown here - image c6

NOTE:  As stated before, the Arduino Nano MUST be upside down (shown in image c6) in the end.  You may wish to do as I have done, and push the wires through from the other (top) side of the board, soldering them into place on the underside (now facing up, like image c6).

Unlike the diagram, the brown wire from these pictures is the black/ground wire, the red wire is the yellow/signal wire, and the orange wire is the red VCC/5V from image c5!  Your wires may differ in color as well, if using those supplied with your DHT module as I have done.  Do not get them mixed up - follow any wire back to the DHT to identify it properly.

When complete, trim any protruding slag, or excess length from the wires as they exit the board, once cooled.

Part 4 - Final Assembly                                                         

image.png

gently press down on areas such as those noted with arrows - image d1

1. Cut a piece of the double-sided adhesive foam tape 23mm wide and 45mm tall, with a small notch cut out to allow wires to pass as shown in image d1.  Do not remove the backing to expose the second adhesive side, this backing will remain on permanently as an additional barrier between the sensor, the Arduino, and the wires in the case.

 

2. Place the completed sensor and wires assembly into its slot you cut out in the lid, from the inside.  Cover the entire unit with the tape you cut out, allowing the wires to fit through the notch.  Use a dull plastic "spudger" type tool (image d1) to gently but thoroughly press down at all contact points, bends, and flat areas where the tape should make full contact with the lid and sensor.  Avoid the area of the wires and resistor, and the soldering points - use only a finger or thumb and gentle pressure in the area over wires to ensure a light contact.  We don't want to break any of the solder or unintentionally bridge the contacts.


Do the same for the tape covering the magnet in the case - press into the bends and flat areas to ensure permanent contact.  Do not compress the part on the top of the magnet too much - we need this pile to be between 3-5mm to make contact with the Arduino Nano when it is finally in place.

image.png

first remove backing from tape, then apply the SuperGlue - image d2

3. Before proceeding, with the protective backing still on the tape covering the magnet (still "un-sticky"), test fit the Arduino Nano into the case one last time - make sure the USB port sits flush with the base of the case as it exits, and the PCB board is flush with the edge of the case with the USB port hole (such as in image d3).  Ensure that the back of the Arduino overlapping the magnet touches the tape and the peel covering it - this is the last chance to make it taller with another bit of tape, if you used a different or thinner type of tape not recommended by this guide.  It should be a foam type tape with some give, and adding to the height of the magnet enough to make contact with the Arduino (about as tall as the USB port on the other side, 4mm).

When ready, first remove the backing peel entirely from the double-sided adhesive covering the magnet - a sharp pair of tweezers can help here, it is NOT EASY and your luck may vary (condolences, I use this stuff all the time because it is so great, but for this one flaw - actually getting the backing off once it's in place can be painful!).

Once you're done fighting the Gorilla tape and got the backing peel off, place a small dot of SuperGlue inside the case near the USB port passthrough hole.  In the example image d2 there is almost too much, half this much would do - you can use a cotton swab to soak up some of the glue before it dries, but this entire procedure must be done swiftly.

Before the SuperGlue dries, very carefully slot the Arduino Nano into the case at an angle, with the USB port first, keeping the back from touching the tape yet - slide the Arduino USB port through the hole and then lower the back end down into position above the tape, keeping the PCB flush with the case wall, and the USB port through the hole as it makes contact with and compresses the SuperGlue.  Quickly dab up any SuperGlue that may leak out of the hole and outside the case.

 

image.png

apply light pressure on right and strong pressure on left - image d3

4. Referring to image d3, with light & gentle finger pressure, press down on the area noted by the arrow on the right, while also using a more firm finger pressure to press down on the area noted by the arrow on the left (over the tape/magnet).  Be sure not to put a lot of pressure on the right where those components are, it is not necessary - the SuperGlue will do its job, we just need to give it light pressure to help spread the SuperGlue and ensure flush contact as we put greater pressure on the left where there are no components and we want full contact with that tape.

image.png

 fully assembled - image d4

5. Before closing the lid, allow up to several minutes for the SuperGlue to dry.  Take this time to plan the bends or separations in the ribbon wire (if using one) so that each wire can sit in a sort-of zig-zag fashion once we do close the lid.  In image d3, the wires are actually a bit long and will require an extra 'zag' to fit, so I have separated the wires nearly to the first bend.  The first bend by the lid and notch in the tape must be acute & firm without crimping!

Once the SuperGlue is dry, carefully guide the wires into places they won't impede as you close the lid - start from the far end away from the wires, and lower it into place over the USB port side lastly.  Be careful not to force it closed, adjust as needed to ensure a tight fit without jamming the wires into hard crimps or bends which could sever tiny wires in the braid inside the wire jacket.

 

image.png

The Official AVCS-DHT1 sticker label - image d5

6. The AVCS-DHT1 Sensor (being magnetic) is designed to stick to a PC case in a vertical orientation somewhere not far from the intake, but far enough from intake fans to not be 'cooled by the wind'.  The back of the ABS plastic case on the sensor can potentially mar or scuff softer paint on a PC case, so it is advised to place a piece of black electrical tape or even Scotch Tape along this surface simply to ensure a softer contact with the PC.

All AVCS-DHT1 sensors built by me and sold in the VG Store will have this sticker label (shown in image d5), which also serves this purpose as a softer backing to help avoid minor scuffing over time.  If using one of these labels, carefully cut around the grey box on the label leaving about a 1-2mm margin as shown.  You may consider peeling back and folding a crease in the wax paper backing, then folding back into place over the adhesive surface, before cutting the label to size - this will help more easily remove the backing once you've trimmed off the edges of the label.

Unlike the high cost of shipping pre-built sensors around the world, I can offer these cool little AVCS-DHT1 sticker labels to anyone following this DIY Build Guide for a fairly low price in the VG Store including free domestic and international shipping to around 180 countries.  It's much cheaper to mail a small envelope than a box, of course. 😉  Click Here to open the VG Store in a new browser tab to check out these sticker labels.

Part 5 - Uploading the Code                                                

AVCS_DHT1_DIY_Sensor_v3

7. At long last, we can upload the Arduino sketch to the device and get some sensor data onto the computer!  Start by connecting the AVCS-DHT1 sensor to the computer with the USB cable, and mount it as noted, on the front or side of the computer near the intake but not within range of wind created by intake fans.  The area of the panel where the sensor sits should not be near any internal components which get hot under heavy PC use.

 

8. Open the Arduino IDE program again.  Under the 'File' Menu, select 'New' (or press CTRL+N) to create a new sketch called "AVCS_DHT1_DIY_Sensor_v3".  Select the entire contents of this new sketch and delete them so you have a blank text area to paste into.

Next, Expand Contents of the code block above - copy the entire contents of the code block here from line number 1 through line number 86.  You can copy the code block to your clipboard more easily by clicking the "Download Raw" button provided by Pastebin, and select all the text on that page & copy it.  Finally, paste the entire code into your sketch in the Arduino IDE (overwriting any contents) and save the sketch (CTRL+S).  Now we can upload the sketch from the Arduino IDE program to the Arduino Nano by pressing the ( image.png ) upload button just as we did with the Blink sketch above.  When uploading is done, close the Arduino IDE program and proceed with testing at step 9 below.

If you see any problems in the errors and information window below the sketch when trying to upload and if the title bar over this information window at the bottom of the sketch does not show the words  ( image.png ) when done, stop and get Help or Support from the links in the Addendum at the bottom of this guide.

 

image.png

 AVCS SENS profile version shown above may differ from latest - image e1

9. Launch the VoiceAttack program and switch to the AVCS Sensors & Weather Profile (if not already running and loaded).  When voice commands are available, say, "Open the Sensor Menu".  The AVCS SENS Main Menu will pop up.  Press the "OPTIONS" button, and then press the "Sensor Options" button.

In the Sensor Options screen, press the "Test Arduino DHT11 Sensor" button - there will be a voice reply of either "Test Succeeded" or, of course, "Failed".  Upon a successful test, the VoiceAttack Event Log (shown in image e1) will display several text messages, including a sample of the data received such as:

AVCS-DHT1 Data: [AVCS,22.75,65.00,72.95,73.00,DHT1]

image.pngimage.pngimage.png

DHT Monitoring in AVCS SENS is a
secondary monitor tied to the Sensor
and/or Weather Monitor.  If either of
these are started, DHT Monitoring
will try to start.  If no DHT sensor is
detected, indoor weather & sensor
diagnostic commands will not work.
If both Sensor & Weather Monitoring
are turned off while DHT Monitor is on,
the DHT Monitor will also turn off.

 

Congratulations on successfully building an AVCS-DHT1 Sensor!  Enjoy the indoor weather & PC sensor diagnostic voice commands!
*alternatively, if you were not so successful, please see links below in the addendum for help & support on a variety of topics.  I am also happy to provide assistance here if you would like to reply below, or through private message here or on Discord - whatever is preferrable

 

Addendum - Help & Support for this DIY Arduino Project

 If you need help, post up a reply below and I'll answer as soon as I see it.  Otherwise, here are some helpful links pertaining to this project:                                                                    

"AVCS SENS", including the Profile Package for VoiceAttack, the AVCS SENS Wiki page, the AVCS-DHT1 Sensor and Sticker Label, and this DIY build guide, comprise creative works by SemlerPDX shared under CC BY-NC-ND 4.0 March/June 2022
AIDA64 is not affiliated with AVCS or this DIY project.  Images and text depicting the AID64 program(s), title, logo, or other elements belonging to AIDA64 or FinalWire Ltd. are used only for educational and/or instructional purposes, relating to demonstration & use, in this DIY project guide.
AIDA64 is a Registered Trademark of FinalWire Ltd. ©2010-2023 All rights reserved.

1 Comment


Recommended Comments

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Add a comment...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

Terms of Use and Privacy Policy

back-to-top