Introduction: DHT22 Sensor

About: Bantam Tools desktop CNC machines provide professional reliability and precision at an affordable price. (Bantam Tools was formerly Other Machine Co.)

In this project guide, we show you how to make the popular DHT22 sensor. This DHT22 easily connects to a variety of microcontrollers to send digital temperature and humidity readouts. You can monitor temperatures on your phone, create an alarm to signal when humidity reaches a certain level, or simply read statuses on your computer.

Step 1: Gather Tools, Materials, and Files

TOOLS

MATERIALS

FILES

Step 2: Set Up Your Job

Hook up the Desktop PCB Milling Machine to your computer, open the Bantam Tools Desktop Milling Machine Software, and home the mill. Next, install the alignment bracket onto the spoilboard. In the Bantam Tools software, under Fixturing, select Locate and follow the instructions.

Note: Using the alignment bracket will ensure that your board is perfectly squared in the front left corner. If you haven’t installed the alignment bracket before, follow the steps in our support guide.

Now it’s time to set up your job. If you need more guidance on how to load your tool or enter information into the software, refer to the Light-Up PCB Badge project.

  1. Double-check to make sure it says Bracket under Fixturing.

  2. Select the 1/32” Flat End Mill, load it into the mill with the bit fan attached, and locate the tool.

  3. In the Material Setup tab measure and enter dimensions in the X, Y, and Z values under Material for the FR-1.

  4. Then apply high-strength, double-sided tape on the backside of the PCB, and place it onto the spoilboard so it aligns with the corner of the alignment bracket.

  5. Be sure to account for the tape’s thickness (Z height) in Material Offset Z. The thickness of the high-strength, double-sided Nitto tape we sell in our store is typically 0.006 in.

Step 3: Import Your File

In the Bantam Tools software, under Plans, click Open Files and select the Humidity-Temperature-Sensor.brd file. You have the option to use both the 1/32” and 1/64” flat end mills or just the 1/64” flat end mill for this job. Using both end mills will cut your mill time to about three minutes, and if you only use the 1/64” end mill, it’ll take roughly eight minutes. For this project, we used the following recipes.

For the 1/64” flat end mill:

  • Feed Rate: 50 in/min
  • Plunge Rate: 15.00 in
  • Spindle Speed: 25,000 RPM
  • Stepover: 50%
  • Pass Depth: 0.007 in

For the 1/32" flat end mill:

  • Feed Rate: 59 in/min
  • Plunge Rate: 15 in
  • Spindle Speed: 25,000 RPM
  • Stepover: 49%
  • Pass Depth: 0.010 in

Your mill time will also vary depending on your speeds and feeds recipes. If you’d like to adjust your speeds and feeds to match ours, click File > Tool Library > Add Tool. Name your new tools and then input the speeds and feeds recipes. You can learn more about customizing your Tool Library in our guide.

Step 4: Start Milling

Ready? Click Start Milling.

If you’re using both the 1/64” and 1/32” flat end mills, the software will prompt you to change your tool. Swap out your tool, install the new one with the bit fan, locate the tool, and select Mill All Visible to finish your job.

Step 5: Solder the Components

Lay out your components and turn on your soldering iron. It’s easiest to solder the components in the following order:

  1. 4.7K resistor
  2. 1K resistor
  3. 0.1uF ceramic capacitor
  4. Male headers
  5. LED
  6. DHT22 sensor (bend the legs before soldering)

On the sensor module, the DHT22 is intended to rest perpendicular to the board. There’s a 4.7K pull-up resistor on the data line, a 0.1uF filtering capacitor on the VCC line, and a power-indicating LED via a 1K resistor. The 90º male headers will allow for easy breadboarding.

Step 6: Program Your Test Sensor

Now that you’ve assembled the circuit board, it’s time to program and test your sensor. Install the Adafruit DHT-sensor-library, if you haven’t already done so. Then select Examples > DHT Sensor Library > DHTtester. Connect the 5V to pin 1 on the module, D2 to pin 2, and GND to pin 3. The DHT22 is the default typeset in the example sketch, so you’ll need to change this in the code if you’re using a different DHTxx sensor. When you’re finished, upload the code and open the Serial Monitor.

Step 7: Utilize Your New Sensor

Nice job! You’ve successfully milled and programmed your own DHT22 sensor. Want to take things to the next level? Here are three of the many projects where you can utilize your new sensor: Smart Plant Care System, Soil Moisture Sensor, and Apple HomeKit Temperature Sensor.