Hand-held Lottery Number Generator and Temperature and Humidity Meter




Introduction: Hand-held Lottery Number Generator and Temperature and Humidity Meter

This unit shows the actual temperature and humidity level after it booted up. The first two digits on the display represent the humidity, and the second two digits shows the temperate readings. If someone starts shaking the unit it will generate two random decimal numbers. The unit will pick random decimal numbers from the 1 to 90 range in default. The range can be changed with touch buttons. If someone touches one of the buttons, the display shows two decimal numbers. The first is the minimum value of the range and the second number is the maximum value.

Button 1 increases the first digit of the display (the min. value increase with 10).

Button 2 increases the second digit of the display (the min. value increase with 1).

Button 3 increases the third digit of the display (the max. value increase with 10).

Button 4 increases the fourth digit of the display (the max. value increase with 1).

The unit is powered by two AAA batteries. The internal voltage is regulated up 5 V. It has a built in accelerometer which detecting if the unit is moving.

Step 1: PCB and Components

Manufacture the PCB board according gerber files.Or simply build it on a proto board.

BOM list:

1pc TTP224 4- Channel Digital Touch Sensor Module Capacitive Touch Switch

1pc CM0 DIY Capless 2-AAA Battery Holder Cases Boxs w/ Lead Line - Black

1pc Mini Slide Switch DIY Parts - Silver

1pc 1A 3V to 5V DC-DC Converter Step Up Boost Module

1pc 5V-3V IIC UART SPI Four Channel Level Converter Module for Arduino

1pc 4 digital display with adjustable brightness LED module clock Point Accessories Blocks for arduino

1pc ATMEGA328P Pro Mini 328 Mini ATMEGA328 5V 16MHz for Arduino 5V 16M With the bootloader

1pc GY-291 ADXL345 digital three-axis acceleration of gravity tilt module IIC / SPI transmission

1pc DHT-11 DHT11 Digital temperature and humidity sensor probe

1 pc crochet made with Crochet for Gadget


Step 2: Assembly PCB and the Components 1.


1. Soldering PIN-s on booth side.

2. Install switch. (prototype had small drills, corrected in v12 )

3. Install DHT 11 temperature and humidity sensor. (prototype had only 3 connection because it was planned to use with DHT 22, corrected in v12 booth DHT11 and DHT22 can be used, resistors should decide )

4. Fix battery holder with two screw and solder connection. (prototype had polarity problem, and small drills, corrected in v12 )

Step 3: Assembly PCB and the Components 2.

Upload the attached software.

For uploading or changing the code download and install Arduino Software.

Use a Crius FTDI Basic Breakout 5V USB to TTL 6-Pin Module (other downloader could also work), to connect the PC to the Arduino.

I used the following libraries thanks for them, before using check their licencing:

"Wire.h" //https://www.arduino.cc/en/reference/wire

"ADXL345.h" //https://code.google.com/p/adxl345driver/

“Timer.h” //http://playground.arduino.cc/Code/Timer

"TM1637.h" //https://github.com/reeedstudio/libraries/tree/master/DigitalTube

"DHT.h" //http://playground.arduino.cc/Main/DHTLib

"Timer.h" //http://playground.arduino.cc/Code/Time

1. Upload the program before soldering.
Test the board, than solder it.

2. Solder display, buttons, level shifter,

3. Before solder power regulator step up converter it produce to high Voltage (5.3V), use diodes to reduce the VCC. I used two connected serial.

4. Turn on and enjoy it. video: https://youtu.be/OaifBikhXyg

Step 4: Design a Crochet

{"context":{"location":{"href":"https://www.instructables.com/editInstructable/publish/ETQZFGYINEQZXLJ","origin":"https://www.instructables.com","protocol":"http:","host":"www.instructables.com","hostname":"www.instructables.com","port":"","pathname":"/editInstructable/publish/ETQZFGYINEQZXLJ","search":"","hash":""},"jQuery1102004661326253313658":1,"b":{"sizzle-1483229848233":{"parentNode":["6781 44",256]}},"h":{},"gtmHasClickListenerTag":true,"gtmHasLinkClickListenerTag":true,"gtmLinkClickListener":true},"selector":"#editor-Object-47"}

Soft Toys Challenge

Participated in the
Soft Toys Challenge

Be the First to Share


    • Science Fair Challenge

      Science Fair Challenge
    • Stone Concrete Cement Contest

      Stone Concrete Cement Contest
    • Stick It Challenge

      Stick It Challenge



    5 years ago

    I like this!!! I would also add some mixture of the seed being derived from XORing accelerometer shakes deltaT's ( more then one axis), temp, humidity, and the analog read A0: is that just an A/D read of the open pin? Does it change radically from successive reads? Very cool and well done!


    Reply 5 years ago

    Yes. A0 is an open PIN. It changes slowly, but between reading there are seconds so it works ok.


    Reply 5 years ago

    Please never take my comments as trolling. I try to only comment on stuff I really like. I was a HW/SW designer for a large point of sale company and we had to generate true random seeds for certain aspects of the terminals. One method used did checksums over volatile memory or registers prior to being initialized. Some ideas used dynamic memory that was temporarily refreshed then tested during charge fade. I just wanted to help to improve seeding for lottery chaos happiness.


    Reply 5 years ago

    It's okay .No offense taken. Thank you for your help. Do you have any concrete code example that I can check?


    Reply 5 years ago

    I will work some up.