Sending the temperature to a ThingSpeak channel using the TMP35 sensor.
This is a small and low cost implementation of IoT (Internet of Things, possibly one of the next technological revolutions).
The ESP8266 can be used alone thanks to the apparition of several environments like LUA, C, Micro Python etc..
In this case I wanted to keep the solution in the Arduino environment to take advantage of many ready-to-use libraries and examples. Then I realized, due the reduced space in the Trinket (5.310Kb for code), the usability of such libraries it’s not so simple.
Programming the ATtiny85 with an ISP programmer will permit the use of the full 8K programming memory.
Anyway was a fun project, is great to see the small ATtiny85 acting as a Web Client.
Let’s make the Trinket do the job using just the Arduino IDE.
The ESP8266 is power hungry when is communicating with a Wi-Fi spot. It can reach 215mA in Transmit Mode.
The 3.3Vregulator in the Trinket only supply 150mA max.
Then we need to use another 3.3V power source.
The L4931 (250 mA) is working at first. Two capacitors were added for stability, one in the input and another in the output.
(….. on the works)
Making the ESP8266 breadboard friendly:
To modify the ESP8266 we need a 0.1″ 4-pin right-angle male header (Not included in the part list).
First cut (remove) the row of pines closer to the board border.
Then, using a breadboard as guide and support, sold the right-angle header.
Use enough solder to obtain a good mechanical resistance.
More images in this post:
Mini breadboard wiring:
Wire color identification:
Orange: 3.3V from the L4931 regulator.
Yellow: Trinket RX data (ESP8266 TX).
Purple: Trinket TX data (ESP8266 RX).
Green: Trinket analog input (TMP36 Vout).
Everything in it’s place… let’s coding…
Temperature Sensor TMP35:
The Trinket Sketch:
At first, just ported the code from a working example made with the Meduino NANO and the DHT22 temperature sensor, finding out that the code size will be a problem.
Several changes were implemented to reduce the code size:
Changing to the TMP35 temperature sensor because is easier to read (don’t need a library ).
Avoiding the use of string manipulation functions.
Avoiding the use of floating math operations. (Only integer math was used).
Integrating CR and LF at the end of the strings and using print() function instead of println().
Many other changes until the compiler of the Arduino IDE announced:
Binary sketch size: 5,196 bytes (of a 5,310 byte maximum)
(soon… need to be documented an cleaned….)
Mini Client part list :
Pictures from the Adafruit Industries web page.
1.- USB cable – A/MiniB. 1
2.- Hook-up Wire 22AWG Solid Core (assorted colors) . 1
3.- Tiny breadboard 170 contacts. 1
4.- Adafruit’s Trinket – Mini Microcontroller – 3.3V Logic 1
5.- 3.3V 250mA Linear Voltage Regulator – L4931-3.3 TO-92 1
6.- 10uF 50V Electrolytic Capacitor. 2
7.-TMP35 – Analog Temperature sensor. 1
8.- ESP8266 WiFi Module. 1
A 0.1″ 4-pin right-angle male header is recommended to adapt the ESP8266 to the breadboard.
This Post Is Under Construction…
Just receive some samples of the ESP-01 board. My first thought was how to use it with a breadboard?.
Doing some Web research found several custom adapters and DIY ideas.
After some brainstorming and a couple of coffees find out a simple procedure to have the ESP8266 nicely plugged in my breadboard.
The solution implies to cut four pins and solder a four pin 0.1 right-angle male header.
The adhesive silicone dot helps to plug the module leveled.
The following images explain themselves:
Ready for IoT fun projects…
Sending random values of temperature and humidity to ThingSpeak:
Two years ago I found the MEDUINO in Ebay (5 pieces for $44.95 including shipping).
Since then I have used them in several projects with good results.
For less than 10 bucks, you have an Arduino NANO compatible device with selectable working voltage (3.3V or 5V), additionally, you can use it as a USB-Serial adapter (FTDI chip) to interface or monitor other serial devices.
Meduino 3.3V capturing data from the ADXL335 accelerometer.
Meduino 5V transmiting light intensity from the Single Pixel Camera to Processing.
Meduino 3.3V as a USB-Serial adapter to check MODBUS protocol with the electric imp.
Meduino 3.3V as power source and USB serial adapter for the ESP8266 Wi-Fi module.
The pin arrangement is like the Arduino NANO but with the Mini-USB connector on the opposite side. The PCB of the Meduino is also slightly larger.
Meduino NANO and Arduino NANO pin assignment
The selectable Vcc (3.3/5V) is great to interface with different sensors and hardware.
One thing to consider for “serious” applications is the crystal frequency at 3.3V.
The ATMega328 datasheet shows a Safe Operating Area, the maximum recommended frequency for 3.3V operation is 13.3 MHz.
The Meduino NANO with 3.3V at 16MHz is out of the recommended frequency but for experimenting purposes at room temperature, is a very handy and low cost Arduino.
Dealing with linear Sensor Arrays is not easy. After some research in the web, found some experiments with TSL1401, TSL202R and TSL201R, many of them without a happy ending.
My intent is to find out how to do simple image processing of Linear Sensor Arrays using the Arduino.
This will open the path to develop some interesting experiments and applications:
-Line Follower Robots.
-Optical Flow Sensor (to sense movement in robots and autonomous vehicles).
-Laser Range Finders.
-Imagen Scanners (Barcode, character recognition etc.)
-Objet Detection and Objet Counting.
-Objet Shape Identification and Analysis.
-Light Spectrum Analyzers.
After reading the (64×1) linear Sensor Arrays TSL201R manual…
…decided to buy some DIP-8 versions (package discontinued) in Aliexpress.com, (breadboard friendly).
This is the wiring diagram:
Arduino NANO, solid wires (AWG#22) and an adequate breadboard for the job.
Pinhole cameras using PCB Relay’s cases:
Because the small hole, more integration time is necessary.
The projected image field of view can be estimated using geometry…
The application in Progressing shows the illuminance of each pixel sent by the arduino.
Integration time and frames per second (FPS) are also presented.
Here is an example of how to use the sensor to estimate the position of a floating ball.
Another possible application, a laser ranger:
Working to increase the frames per second (FPS)…
Will be continued…
(in twitter you can follow my progress before it be posted here ): @arduining
After receiving a bunch of Trinkets, my first impulse was to do some photographic composition…