Translate

Showing posts with label DS1820. Show all posts
Showing posts with label DS1820. Show all posts

Sunday, March 26, 2023

Server chronical - Digitemp - reading from DS1490F

Digitemp is a software capable to read Dallas 1Wire sensors for the temperature, the DS18S20.

It was in use on the old server for years in order to acquire different temperatures and thus control automatically some Fans in the server room.

Let's see if it can be revived in the new server.

Sunday, September 10, 2017

Working on Teirmilab

Here a step-by-step guide to work on git for the TeirmiLab project.
If you are new on git and github, read this article first

TheTeirmiLab project is on bitbucket public.
If somebody wants to join it to enhance the project would be nice if contact me.
Bitbucket has limited number of collaborators unless pay.
Let start from the link for the TeirmiLab bitbucket project :
https://bitbucket.org/account/user/hanixdiy/projects/TEIR

Clone TeirmiLab

Use git to clone the TeirmiLab project (see a specific repository in the project)
That's it !
On your directory, will exist a directory called TeirmiLab, containing the code.

Or better, just download a zip file from bitbucket.


Wednesday, December 3, 2014

TeirmiLab - Raspberry Pi prototype



This article describes the building of a TeirmiLab prototype based on a Raspberry Pi B board.
The goal using a Raspberry Pi is to have a machine that can be expanded later.




Shopping list


The idea is to use a traditional LCD display instead a more sophisticate touch screen display.
Mainly the reasons :
  • is not expensive
  • doesn't require to develop a graphic interface for it
  • allows to focus on the purpose - to show a temperature
  • can be easily placed inside a protective container (no touch capabilities)

Hardware


Here a initial schematic for the TeirmiLab-Pi.



The RTC clock module is actually necessary only for the enhanced version, for the data-log feature, however it will be tested also on the base version.
The idea is to use as much as possible "ready to use" modules, like the RGB display, the GPIO I2C expander and so on, in order to use already made code (see the Software section).

The encoder will be connected directly to the Raspberry GPIO as well as the interrupt signal from the MCP23017 (optional for now), in order to be able to detect faster changes from the keyboard.
The internal pullup resistors for the encoder will be enabled.

First tests on a breadboard
The second prototype on perforated board

The second prototype on perforated board
The second prototype with the keyboard and RPOf cable connected
The keyboard is working fine, however it would be better to have an easiest way to select an alarm or set up the offset.
A new version of the hardware will include a digital encoder to be used instead the keyboard (see below).

The prototype installed on a wooden platform for a more mechanical stability.
A monochromatic LCD is used instead an RGB one

The prototype installed on a wooden platform for a more mechanical stability.
The round PCB is hosting the RPOf to be piggy-bagged on a MSP430 Launchpad
The used board for the prototype is a Raspberry Pi B, however the final installation will use a Raspberry Pi A+ because the reduced dimensions and power usage.
A new interface board is under development.

GPIO Use

Here a table for the GPIO use :

Raspberry GPIO MCP GPIO Direction Description

GPA0 Output LCD

GPA1 Output LCD

GPA2 Output LCD

GPA3 Output LCD

GPA4 Output LCD

GPA5 Output LCD

GPA6 Output LCD

GPA7 Output LCD





GPB0 Output LCD

GPB1


GPB2


GPB3


GPB4 Input Keyboard 1

GPB5 Input Keyboard 2

GPB6 Input Keyboard 3

GPB7 Input Keyboard 4




GPIO4
Input/Output 1Wire protocol
GPIO17
Input Shutdown input
GPIO18
Output Shutdown feedback
GPIO22
Output Buzzer
GPIO23
Input Encoder A
GPIO24
Input Encoder B
GPIO25
Input Encoder switch


Sensor


With the sensor used (DS18B20) the TeirmiLab has these basic characteristics:

  • Range -55 to 125°C (-67°F to +257°F)
  • ±0.5°C Accuracy from -10°C to +85°C

Keyboard


The TeirmiLab-Pi needs to have at least 3 push buttons in order to do some settings.
  • a Mode button
    Allows to select different modes, like "display temperature" or "Set alarm" or "Set offset"
  • two + and - buttons
    Allows to increase or decrease a value, like the alarm temperature or the offset

Encoder


Instead of the keyboard, it is more easy to use a mechanical digital encoder with an embedded pushbutton for the selection.
The pushbutton acts as Mode button and rotating the encoder cause the values to change.

The video is showing the encoder operations

Power Supply


The instrument must be powered.
An USB wall wart, with at least 1 A, will be the power source for the Teirmilab.

A main switch will be necessary in order to correctly power up and power down  the instrument (see RPOf project)

Container


All the electronic will be placed in a transparent plastic box.
This will allow to reduce the drilling to the minimum, basically for the main power switch and eventually for some push buttons if not other means are used.
The display will remain totally protected but visible behind the clear plastic.

Saturday, October 4, 2014

TeirmiLab - Designing a laboratory thermometer

Sometime is necessary to "reinvent the hot water".
In a  laboratory is necessary to measure the temperature of liquids and not always are easily available the last technological gadgets or practical one.

This article describes very generally some characteristics, requirements and usage of the gadget to design, a thermometer to be used in a laboratory

Important ! This project is based on specific requirements. Is not meant to be a "universal laboratory thermometer" but rather an instrument with specific characteristics needed in a specific laboratory.
The idea is that it can become a starting base for similar lab thermometers.

So here this project trying to design and build quickly a thermometer suitable to be used in a laboratory : the TeirmiLab

Lets start with the name.
The name is invented taking the first part of the Irish translation of "thermometer" (teirmiméadar) and of course "Lab" does not need of explanation.
Why Irish ? Well, I liked the sound of the name. The beauty of globalization.

The idea is to have a versatile and flexible instrument, capable to collect temperatures with probes attached to the display unit, measuring the current temperature, the minimum one, the maximum and work optionally as data logger.

The TeirmiLab can be also connected to a network (enhanced version), adding the possibility to see the current measurement in real time over a browser and adding graphic capabilities, remote setting of the unit and so on.

On the market do exists a lot of thermometers for laboratory use, but one of the goal of the project is to create an open platform and a thus customizable one, without spending up to thousand dollars.

The precision of the TeirmiLab initially is set as the sensor used, the DS1820. 

Requirements


The TeirmiLab should be able to performs these functions (the list has no particular priority)

Basic

  • minimal and intuitive user interface
  • read one sensor. The sensor should be detachable to be able to change it or clean it
  • display the temperature away from the sensor
  • display the temperature in Celsius or Farheneit or Kelvin
  • Alarm
  • Capability to offset the reading locally (setup)
  • Capability to set the alarm locally

Enhanced

  • read more than one sensor
  • display locally the min and max temperature
  • data logger capability
  • capability to store locally temperatures for an amount of time
    • setting for the measurement interval
    • setting for start and stop
    • capability to transfer the log to a remote computer
  • remote connection capability
    • setting alarms
    • offsetting a probe
    • download log
    • reset log
  • remote display capability
  • (optional) print results locally
  • (optional) RFID reader for identification 
Let see more in details some requirements for the basic version/

Minimal and intuitive user interface

In a world of "apps" it is easy to forget that sometime is more important a practical approach rather than a fancy one.
The user interface of the instrument is based on a "traditional" LCD display and few push-buttons.
No fancy touch screen with nice graphics.
A lab instrument needs to be first of all simple and immediate to use and sturdy, ANYBODY should be able to use it after 5 minutes and the tools itself must be capable to work in an hostile environments (spills, dirt, etc.)

Alarm

The TeirmiLab should have the capability to generate an alarm if a specific temperature is reached.
The alarm can be visual (change color of the display for example), audio (buzzer) or web based (browser pop up).

Remote display from the sensor

The sensor should be detached from the main unit, i.e. connected via cable.
The thermometer should be placed away (inches) from the source to measure so to easily locally display the temperature on a local display

Local settings

It must be possible to set locally some functionality, like setting an alarm or setting up an offset.
So a mini keyboard with at least three pushbutton is necessary.
Alternatively is possible to use a rotary digital  encoder with a pushbutton.

Keyboard/Keypad


Here a button requirements:
  • Mode
    The Mode button allows to change the state of the instrument.
    There are 4 modes :
    • Run  (default mode)
      In this mode the temperature read from the sensor is displayed in real time (every second).
      If the alarm is set, the display will show the normal temperature in Green and will switch in Red when the alarm is reached.
    • Measurement unit
      By default the measurement unit is in Celsius.
      Alternatively is possible to select Fahrenheit or Kelvin
      The selection of the measurement unit automatically update the current values (alarm/offset)
    • Alarm Set
      In this mode is possible to enter the alarm temperature, using other two pushbutton to increment or decrement such value
    • Offset Set
      Some sensors can have an offset. This mode allows to add a value to the reading to offset the sensor.
  • Increment
    The Increment button (+) allows to increment a value
  • Decrement
    The Decrement button (-) allows to decrement a value

Digital Rotary Encoder


The pushbutton on the encode select the mode, then rotating the encoder clockwise will increase a value. Rotating the encoder counterclockwise will decrease a value.
  • Mode
    The push button  allows to change the state of the instrument.
    There are 4 modes :
    • Run  (default mode)
      In this mode the temperature read from the sensor is displayed in real time (every second).
      If the alarm is set, the display will show the normal temperature in Green and will switch in Red when the alarm is reached.
    • Measurement unit
      By default the measurement unit is in Celsius.
      Alternatively is possible to select Fahrenheit or Kelvin
      The selection of the measurement unit automatically update the current values (alarm/offset).
      Rotating the encoder will change the selection
    • Alarm Set
      In this mode is possible to enter the alarm temperature, rotate the encoder clockwise or counterclockwise to increase and decrease the alarm temperature
    • Offset Set
      Some sensors can have an offset. This mode allows to add a value to the reading to offset the sensor.
    • Reset
      This option reset the TeirmiLab in a known configuration
      • Unit used : Celsius
      • Alarm disabled
      • Alarm value = 0
      • Offset = 0
  • Setting
    When in a specific mode, rotating the encoder clockwise or counterclockwise will change the selection.

Tuesday, September 9, 2014

Raspberry Pi - reading a DS18S20

One of the most common things for any embedded device is the capability to read temperatures.

Raspberry Pi doesn't has any ADC by default, so unless to hook one, the common way to read temperatures is via digital chips, like the DS 18S20.

The DS 18S20 is a 1-wire protocol chip-set from Dallas.
Fortunately somebody already wrote a bit banging support for the 1Wire protocol used by this chip-set , so it is only matter to connect the chip and enable some kernel modules to do so, at least in Raspbian (Wheezi).

I was able to duplicate the results described in the article RaspberryPI DS1820 without problems.
The example is based on a Perl script using the kernel services.

Here some my extra notes (I don't understand why so many people stopped to draw standard electronic schematics in favor of "cartoon" schematics).

Basic schematic to connect a DS1820 to the Raspberry Pi Gpio port.


Raspberry Pi GPIO pinout

DS1820 pinout







By default (as described in the article) the kernel module capable to handle the 1-Wire is disabled.
As first thing is necessary to enable it.




Open a terminal, then :
  • sudo modprobe wire
  • sudo modprobe w1-gpio  
  • sudo modprobe w1-therm

After that, to test if the DS1820 is ready and connected correctly :
  • cat /sys/bus/w1/devices/w1_bus_master1/w1_master_slave_count
The result should be the number of DS1820 connected.
To retrieve the serial number of the chip-sets :
  • cat /sys/bus/w1/devices/w1_bus_master1/w1_master_slaves
This is the Perl script used to read a sensor, copied from the article of David Mills,  RaspberryPI DS1820 (read that article for more details and how to read two sensors).

#!/usr/bin/perl
$mods = `cat /proc/modules`; 
if ($mods =~ /w1_gpio/ && $mods =~ /w1_therm/) 
   print "w1 modules already loaded \n"; 
else  
   print "loading w1 modules \n"; 
   $mod_gpio = `sudo modprobe w1-gpio`; 
   $mod_them = `sudo modprobe w1-therm`; 

$sensor_temp = `cat /sys/bus/w1/devices/10-*/w1_slave 2>&1`; 
if ($sensor_temp !~ /No such file or directory/) 
   if ($sensor_temp !~ /NO/) 
   { 
      $sensor_temp =~ /t=(\d+)/i; 
      $tempreature = (($1/1000)-6); # My sensor seems to read about 6 degrees high, so quick fudge to fix value  
      print "rPI temp = $tempreature\n";  
      exit; 
   } 
   die "Error locating sensor file or sensor CRC was invalid";  
}