I'm using LibreOffice Calc (4.3.1.2 for Windows - 4.2.7.2 for Linux) and there is no direct support for the hash.
Translate
Tuesday, February 24, 2015
Hashing with LibreOffice (Updates)
For a project, I needed to hash some data from a spreadsheet.
I'm using LibreOffice Calc (4.3.1.2 for Windows - 4.2.7.2 for Linux) and there is no direct support for the hash.
I'm using LibreOffice Calc (4.3.1.2 for Windows - 4.2.7.2 for Linux) and there is no direct support for the hash.
Saturday, February 7, 2015
littleBits - a comment
Recently I discovered the littleBits website.
I'm always looking to easy ways to prototyping ideas. The "traditional way" has always a quite long preparation time, designing the circuit, building a prototype, verify if is working, etc.
So I took a look at this new system to do electronics.
Here what I think about this system. It is important to understand that I'm evaluating it from MY perspective and needs, not from a generic perspective.
Overall I found the idea nicer, but not 100% positive.
The leap I noticed with littleBits was that they creates “virtual” blocks, that are much more than the single component.
I'm always looking to easy ways to prototyping ideas. The "traditional way" has always a quite long preparation time, designing the circuit, building a prototype, verify if is working, etc.
So I took a look at this new system to do electronics.
Here what I think about this system. It is important to understand that I'm evaluating it from MY perspective and needs, not from a generic perspective.
Overall I found the idea nicer, but not 100% positive.
I received my first electronic kit similar in
“concept” when I was 10 years old, in the deep past of 1970s.
Of course it was very basic. No microcontrollers or computers at the time, but I did built a transistor radio and other things.
Of course it was very basic. No microcontrollers or computers at the time, but I did built a transistor radio and other things.
The idea to “simplify” the assembly of electronic circuits
is not new.
The leap I noticed with littleBits was that they creates “virtual” blocks, that are much more than the single component.
A nice well designed training tool, until a certain point.
Let see more in details what I think.
- Simple
Sure it is simple to “assemble” circuit with this system.
But it’s virtue is IMHO also it’s worse defect. I found very probable that people who start to learn about electronics using this system, ends up with no clue about what he/she is doing. Even a “simple” extension (to connect more modules) of this system has some electronic in it (analog buffer with an operational) and people who is supposed to learn “electronic” will never figure out that.Basically in order to simplify the assembly process, they created “meta-components” without any real technical description and a reason why they did it.In order to simplify the manual assembly, the cost is to don’t learn about the “real” components.For example, for each “module” there is a schematic but not a single word of explanation.How somebody is supposed to “learn” about electronic in this way ? - Limited
The simplicity has also another cost : the complexity.Duh … yeah, if it is simple is not complex. But also it means that do even small applications with the “basic” components, is difficult and require a lot of space and modules.Another limit is the fact that each module has only 1 signal line. Love the idea, it simplify the connections, but for example: - Force to deal with analog voltages for everything
- Imply to have a real “clean” power supply, the minimum “noise” on the power and your functionality is gone
- Is
more critical. It’s enough the “tolerance” of many components to introduce
small variations among identical modules.
It could mean to build something and if somebody try to replicate it, to have slightly different results - Cannot
be really fast.
There is a lot of work behind the curtains in order to carry all the signals on a single line and this has a huge impact on the time. Real time systems cannot be really developed with this system
- Price
Well, quite pricey !!
To have enough modules to do some real work probably you have to invest AT LEAST 200-500$ and the material (blocks) are not usable in different projects (unless tear down what built).
To have a full kit, i.e. everything available in enough quantity, is around 4000$ !!!
For that amount you can set up much more than the “basics” with traditional electronic.
I could build a more than decent personal lab with that amount, including quite a wide component selection and a lot of tools, from benches, furniture, power supplies (real ones, not USB limited ), oscilloscopes, logic analyzer and so on. The basic entry point for this system is around 99$ …and really there is not much useful stuff that can be done.
So my impression is that is very nice introductory tool as
long as :
- You have a lot of money to “invest”
- You are NOT interested to really learn electronic but just “build” something, possible guided by someone that tells you what modules to put together
- You are not interested in replicate what you are doing (scale up an application)
- You are not interested to deploy your buildings in the real world (mechanical issues – protection – etc.)
- You have no constrains about space where to put the electronic
- You don’t have to deal with “real time” or precision requirements
What is the “target” of this system then ?
IMHO for somebody who wants to build something more complicated than turn a lamp ON or OFF, but doesn't wants really to learn electronic and is willing to use whatever the “system” make available.
IMHO for somebody who wants to build something more complicated than turn a lamp ON or OFF, but doesn't wants really to learn electronic and is willing to use whatever the “system” make available.
For electronic learning purposes I think that on the long
run the risk to learn the wrong stuff is quite real.
Learning electronic imply to understand how each single component works, its limits and capabilities. Each littleBits module has more than one electronic component inside and understand how is really working imply to know a lot of electronic. So is a catch 22.
The littleBits modules hide totally each electronic component function.
Learning electronic imply to understand how each single component works, its limits and capabilities. Each littleBits module has more than one electronic component inside and understand how is really working imply to know a lot of electronic. So is a catch 22.
The littleBits modules hide totally each electronic component function.
Another potential user of this system is somebody who wants
to see the feasibility of an idea and build a fast prototype.
An alternative way to the use of the breadboard.
An alternative way to the use of the breadboard.
IF the constraints I listed above are meet, it can be done.
However the price is probably ten times more than the traditional way.
And the limits of the system are really too much for professional
use.
Just my 2 cents
Friday, January 9, 2015
TeirmiLab - Use
This article describes how to use the TeirmiLab.
The TeirmiLab is a thermometer with some extra capabilities.
The design allows for these features:
When the desired Alarm temperature is set, press the Mode button.
Introduction
The TeirmiLab is a thermometer with some extra capabilities.
The design allows for these features:
- Range -55 to 125°C (-67°F to +257°F)
- ±0.5°C Accuracy from -10°C to +85°C
- Reading in Celsius, Fahrenheit or Kelvin
- Alarm capability with visual and audio notification
- Offset capability for better tuning the sensor
Operations
Turning the unit On
Verify to have the temperature sensor connected to the instrument via its connector.
Then push the power button.
The light on the power button will flash, indicating that the instrument is powering on.
After approx 30 seconds, the power button light will be steady ON and the LCD display will show a welcome message for few seconds, followed by the temperature reading.
If for any reason the instrument is not starting correctly, the power will be removed automatically.
Contact the TheFwGuy for help if the problem persist.
It is highly discouraged to remove the power supply from the instrument while is working!
Removing the power from the instrument could damage the memory card and thus having the instrument not working anymore (contact the TheFwGuy to restore functionality).
To correctly power down the instrument, push the power button.
The light on the power button will start to flash indicating that the power off procedure started.
When the power off procedure is completed and it is safe to remove the power, the light on the power button will stop to flash turning off, and the power will be removed automatically.
One is used to bright or dim the display.
The other is an encoder with a switch. Pressing the knob will change the instrument mode sequentially.
The available modes are :
Note. Before to access the menu', it can require to push the encoder knob for a couple of seconds.
If the selection is On, pressing the Mode button will go to the Setting Alarm Value selection.
The light on the power button will flash, indicating that the instrument is powering on.
After approx 30 seconds, the power button light will be steady ON and the LCD display will show a welcome message for few seconds, followed by the temperature reading.
If for any reason the instrument is not starting correctly, the power will be removed automatically.
Contact the TheFwGuy for help if the problem persist.
Turning the unit Off
It is highly discouraged to remove the power supply from the instrument while is working!
Removing the power from the instrument could damage the memory card and thus having the instrument not working anymore (contact the TheFwGuy to restore functionality).
To correctly power down the instrument, push the power button.
The light on the power button will start to flash indicating that the power off procedure started.
When the power off procedure is completed and it is safe to remove the power, the light on the power button will stop to flash turning off, and the power will be removed automatically.
General settings
The instrument has two knobs just below the display.One is used to bright or dim the display.
The other is an encoder with a switch. Pressing the knob will change the instrument mode sequentially.
The available modes are :
- Run (default - the instrument starts on this mode)
- Measurement unit setting
- Enabling/Disabling alarm
- Setting alarm value (only if alarm enabled)
- Setting offset value
- Reset the TeirmiLab
- back to number 1
To change mode, simply press the encoder knob.
To change value, rotate the knob clockwise or counterclockwise
Note. Before to access the menu', it can require to push the encoder knob for a couple of seconds.
Measurement unit setting
The LCD will display on the top line "Set Unit" and on the bottom line "Celsius" or "Fahrenheit" or "Kelvin".
Turning the knob clockwise or counterclockwise will change the selection.
To exit from the Measurement unit setting mode, press the Mode button once.
The setting displayed will be used.
The setting displayed will be used.
Enabling/Disabling alarm
The LCD will display on the top line "Enable Alarm" and on the bottom line should be present the current status : On or Off (default Off).
Turning the knob clockwise or counterclockwise will change the selection.
If the selection is Off, pressing the Mode button will skip the Alarm Value step, going directly to the Set Offset Value selection.
If the selection is Off, pressing the Mode button will skip the Alarm Value step, going directly to the Set Offset Value selection.
Setting alarm value
The LCD will display on the top line "Set Alarm" and on the bottom line will be present the last setting for the alarm.
Turning the knob clockwise will increment the alarm value, turning it counterclockwise will decrements the alarm value.
The allowed range for the alarm is :
The allowed range for the alarm is :
- Celsius, from -40 C to +120 C
- Fahrenheit from -40F to +248F
- Kelvin from 233K to 393K
During the Run time, the TeirmiLab will display the current temperature in Green.
When the Alarm temperature is reached, the screen will become Red and a sound will be generated.
Press the Mode button once to reset the Alarm.
Set offset value
The LCD will display on the top line "Set Offset" and on the bottom line will be present the last setting for the offset.
Turning the knob clockwise will increment the offset value, turning it counterclockwise will decrements the offset value.
The offset is used to change the temperature reading in case the sensor measurements are not correct.
Reset the TeirmiLab
The LCD will display on the top line "Reset ?" and on the bottom line will be present the last choice as "Yes" and "No"
Turning the knob clockwise or counterclockwise will change the selection.
If the selection is "Yes", pressing the knob will cause the Reset.
The configuration file will be erased and re-created with the default values.
The configuration file will be erased and re-created with the default values.
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
- Raspberry Pi B or Raspberry Pi B+ or Raspberry Pi A+
- RGB 16x2 LED display
- DS1820 (specifically this one)
- MCP23017 I2C GPIO expander
- I2C RTC clock (optional)
The idea is to use a traditional LCD display instead a more sophisticate touch screen display.
Mainly the reasons :
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 |
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 |
![]() | |
|
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
- 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.
Wednesday, November 12, 2014
MSP430 - How to use mspdebug
When using the MSP430 under Linux, in order to load the compiled code with mspgcc, exists a
utility called mspdebug.
Mspdebug is not part of the MSPGCC toolchain, so it must be downloaded and prepared separatedly.
Also the final placement could end not be in the toolchain path but on a more generic one.
Almost every distribution has it, so the easiest way to install it is from there.
In particular must be installed :
Then :
At the end of the process, the mspdebug program will be placed in /usr/local/bin directory.
Connect the LaunchPad to the host USB
Verify that the interface is seen by the system (the entry to check is highlighted) using lsusb.
steve@Oliver3:~$ lsusb
Bus 008 Device 023: ID 0781:a7c1 SanDisk Corp.
Bus 008 Device 001: ID 0000:0000
Bus 007 Device 018: ID 0451:f432 Texas Instruments, Inc.
Bus 007 Device 016: ID 051d:0002 American Power Conversion Uninterruptible Power Supply
Bus 007 Device 015: ID 06cd:0121 Keyspan USA-19hs serial adapter
Bus 007 Device 014: ID 17d0:0116
Bus 007 Device 003: ID 0409:0058 NEC Corp. HighSpeed Hub
Bus 007 Device 001: ID 0000:0000
Bus 005 Device 002: ID 04a9:2206 Canon, Inc. CanoScan N650U/N656U
Bus 005 Device 001: ID 0000:0000
Bus 004 Device 002: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
Bus 004 Device 001: ID 0000:0000
Bus 003 Device 002: ID 138c:0001
Bus 003 Device 001: ID 0000:0000
Bus 002 Device 003: ID 0a81:0205 Chesen Electronics Corp. PS/2 Keyboard+Mouse Adapter
Bus 002 Device 001: ID 0000:0000
Bus 006 Device 001: ID 0000:0000
Bus 001 Device 001: ID 0000:0000
Unless enabling the USB to a specific user, you need to be superuser to run mspdebug.
The interface to use is called rf2500.
Here a session opened with my main host (Ubuntu 8.04 LTS) and LaunchPad :
steve@Oliver3:~$ sudo mspdebug rf2500
MSPDebug version 0.9 - debugging tool for MSP430 MCUs
Copyright (C) 2009, 2010 Daniel Beer < daniel@tortek.co.nz>
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Trying to open interface 1 on 018
Initializing FET...
FET protocol version is 30066536
Configured for Spy-Bi-Wire
Set Vcc: 3000 mV
Device ID: 0xf201
Device: MSP430F2013
Code memory starts at 0xf800
Available commands:
= erase hexout mw read run sym
cgraph gdb isearch opt regs set
dis help md prog reset step
At this point is possible to work on the target, erasing the memory, loading test code and running the debugger.
Here a sequence of operations to debug the code manually, using the debugger.
It is assumed that the mspdebug program is launched from the directory containing the elf file to debug.
The bolded lines are the ones to digit.
Load the program to be debugged in the microcontroller (from mspdebug)
(mspdebug) prog name_program.elf
Start the remote (target) gdb
(mspdebug) gdb
Bound to port 2000. Now waiting for connection...
At this point open a new terminal and go to the directory where the source code and elf are.
The bolded lines are the ones to digit.
GNU gdb 6.8
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=i686-pc-linux-gnu --target=msp430"...
(gdb)
Attach the debugger to the target
(gdb) target remote localhost:2000
Remote debugging using localhost:2000
0x0000f800 in _reset_vector__ ()
At this point it is possible to debug the code using the gdb commands.
utility called mspdebug.
Installation
Mspdebug is not part of the MSPGCC toolchain, so it must be downloaded and prepared separatedly.
Also the final placement could end not be in the toolchain path but on a more generic one.
Almost every distribution has it, so the easiest way to install it is from there.
Alternatively, is possible to download the code from the mspdebug web site, then be sure to have installed the necessary libraries.
In particular must be installed :
- libncurses5-dev
- zlibc
- zlib1g-dev
- libx11-dev
- libusb-dev
- libreadline5-dev (or libreadline6-dev for newver version of Ubuntu)
Then :
- $ tar xvfz mspdebug-version.tar.gz
- $ cd mspdebug-version
- $ make
- $ sudo make install
At the end of the process, the mspdebug program will be placed in /usr/local/bin directory.
LaunchPad - Use
Preliminary
I'm describing the operations to use mspdebug with the LaunchPad.Connect the LaunchPad to the host USB
Verify that the interface is seen by the system (the entry to check is highlighted) using lsusb.
steve@Oliver3:~$ lsusb
Bus 008 Device 023: ID 0781:a7c1 SanDisk Corp.
Bus 008 Device 001: ID 0000:0000
Bus 007 Device 018: ID 0451:f432 Texas Instruments, Inc.
Bus 007 Device 016: ID 051d:0002 American Power Conversion Uninterruptible Power Supply
Bus 007 Device 015: ID 06cd:0121 Keyspan USA-19hs serial adapter
Bus 007 Device 014: ID 17d0:0116
Bus 007 Device 003: ID 0409:0058 NEC Corp. HighSpeed Hub
Bus 007 Device 001: ID 0000:0000
Bus 005 Device 002: ID 04a9:2206 Canon, Inc. CanoScan N650U/N656U
Bus 005 Device 001: ID 0000:0000
Bus 004 Device 002: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
Bus 004 Device 001: ID 0000:0000
Bus 003 Device 002: ID 138c:0001
Bus 003 Device 001: ID 0000:0000
Bus 002 Device 003: ID 0a81:0205 Chesen Electronics Corp. PS/2 Keyboard+Mouse Adapter
Bus 002 Device 001: ID 0000:0000
Bus 006 Device 001: ID 0000:0000
Bus 001 Device 001: ID 0000:0000
Unless enabling the USB to a specific user, you need to be superuser to run mspdebug.
The interface to use is called rf2500.
Here a session opened with my main host (Ubuntu 8.04 LTS) and LaunchPad :
steve@Oliver3:~$ sudo mspdebug rf2500
MSPDebug version 0.9 - debugging tool for MSP430 MCUs
Copyright (C) 2009, 2010 Daniel Beer < daniel@tortek.co.nz>
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Trying to open interface 1 on 018
Initializing FET...
FET protocol version is 30066536
Configured for Spy-Bi-Wire
Set Vcc: 3000 mV
Device ID: 0xf201
Device: MSP430F2013
Code memory starts at 0xf800
Available commands:
= erase hexout mw read run sym
cgraph gdb isearch opt regs set
dis help md prog reset step
At this point is possible to work on the target, erasing the memory, loading test code and running the debugger.
For example, just to load a program (ELF format) on the MSP430, simply digit from inside the mspdebug program :
prog name_program.elf
Debugger (manual)
Here a sequence of operations to debug the code manually, using the debugger.
It is assumed that the mspdebug program is launched from the directory containing the elf file to debug.
The bolded lines are the ones to digit.
Load the program to be debugged in the microcontroller (from mspdebug)
(mspdebug) prog name_program.elf
Start the remote (target) gdb
(mspdebug) gdb
Bound to port 2000. Now waiting for connection...
At this point open a new terminal and go to the directory where the source code and elf are.
The bolded lines are the ones to digit.
Start the debugger
$ msp430-gdb name_program.elfGNU gdb 6.8
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=i686-pc-linux-gnu --target=msp430"...
(gdb)
Attach the debugger to the target
(gdb) target remote localhost:2000
Remote debugging using localhost:2000
0x0000f800 in _reset_vector__ ()
At this point it is possible to debug the code using the gdb commands.
Saturday, October 25, 2014
Raspberry Pi - RPOf project
Saturday, October 11, 2014
Raspberry Pi - connecting a traditional LCD display (Update)
Raspberry Pi is a powerful enough platform and it is possible to use many recent touchscreen with a nice graphic on it.
However often a traditional LCD is more useful, and surely is more cheap than a touchscreen solution.
Here one way to connect a traditional LCD and use it in projects, like the TeirmiLab one.
This article describes how to connect a traditional LCD but with RGB capabilities to the Raspberry Pi B.
We need :
There are many ways to control the hardware.
For now I found a ready-to-use Python library published by Adafruit that is working nicely.
Again, the important thing is that control an LCD is not a critical task, so a python script is Ok.
Maybe in future I'll explore the possibility to control it directly in C.
Here a quick step-by-step guide (see Adafruit tutorials for a more detailed and easy instructions) :
At this point everything should be installed in order to use the display.
Here a couple of tips and resolutions.
If you start from a fresh installation of Raspbian, especially a lite version, before to start to follow the instructions above, be sure to execute :
Be aware about the type of kit you are using.
On the examples area there are different examples depending the type of display in use.
To test the basic display, use : char_lcd_mcp.py
To test the kit with RGB display and pushbutton use : char_lcd_plate.py
However often a traditional LCD is more useful, and surely is more cheap than a touchscreen solution.
Here one way to connect a traditional LCD and use it in projects, like the TeirmiLab one.
This article describes how to connect a traditional LCD but with RGB capabilities to the Raspberry Pi B.
We need :
- Raspberry Pi B or Raspberry Pi B+
- RGB 16x2 LED display
- MCP23017 I2C GPIO expander
It is possible to hook a display without the need of the GPIO expander, however a normal LCD uses at least 6 signals. 9 if the LCD display is an RGB one like the one used for this project.
Considering that the Raspberry Pi B doesn't have many GPIO available and that usually the speed required to handle the display is not critical, using a chip like the MCP23017 make sense.
In this way it will be enough to "hook" the chip to the I2C bus, leaving all the Raspberry Pi GPIO free for other use.
Considering that the Raspberry Pi B doesn't have many GPIO available and that usually the speed required to handle the display is not critical, using a chip like the MCP23017 make sense.
In this way it will be enough to "hook" the chip to the I2C bus, leaving all the Raspberry Pi GPIO free for other use.
Let see a schematic.
Software
There are many ways to control the hardware.
For now I found a ready-to-use Python library published by Adafruit that is working nicely.
Again, the important thing is that control an LCD is not a critical task, so a python script is Ok.
Maybe in future I'll explore the possibility to control it directly in C.
Python
To use our display we need to install some code in our Raspberry.Here a quick step-by-step guide (see Adafruit tutorials for a more detailed and easy instructions) :
- sudo apt-get update
- sudo apt-get install build-essential python-dev python-smbus python-pip
- sudo apt-get install i2c-tools
- sudo pip install RPi.GPIO
- cd ~
- git clone https://github.com/adafruit/Adafruit_Python_CharLCD.git
- cd Adafruit_Python_CharLCD
- sudo python setup.py install
Before to be able to use it, we need to be sure a configuration file is correctly set-up.
Execute : sudo nano /etc/modules
and if the file exists, add these two lines in the end.
i2c-bcm2708
i2c-bcm2708
i2c-dev
Save the file then open another one in edit.
Execute : sudo nano /etc/modprobe.d/raspi-blacklist.conf
Execute : sudo nano /etc/modprobe.d/raspi-blacklist.conf
In this file comment out the two lines showed below, adding # at the beginning:
#blacklist spi-bcm2708
#blacklist i2c-bcm2708
Reboot Raspberry : sudo shutdown -r now
or : sudo reboot
At this point everything should be installed in order to use the display.
First is better to run an utility to see if the I2C GPIO expander is seen correctly.
sudo i2cdetect -y 1
The command should display a table and in the table should be present a 0x20 address.
pi@raspberrypi ~ $ sudo i2cdetect -y 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: 20 -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
pi@raspberrypi ~ $
If so, the chip is correctly seen by Raspberry.
pi@raspberrypi ~ $ sudo i2cdetect -y 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: 20 -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
pi@raspberrypi ~ $
If so, the chip is correctly seen by Raspberry.
To test if the display is working you can execute a test script :
- cd Adafruit_Python_CharLCD/examples
- sudo ./char_lcd_mcp.py
Some test messages should be displayed on the LCD display.
Troubleshooting
It is possible to have some problems installing the libraries.Here a couple of tips and resolutions.
apt-get missing
If you start from a fresh installation of Raspbian, especially a lite version, before to start to follow the instructions above, be sure to execute :
- sudo apt-get update
- sudo apt-get upgrade
- sudo apt-get update
It is important because updating the first time, include more repo on apt-get.
python build fail
If during the python building of the library you have this errors :
python ./setup.py build
Downloading https://pypi.python.org/packages/source/s/setuptools/setuptools-3.5.1.zip
Extracting in /tmp/tmpw6UbTx
Traceback (most recent call last):
File "./setup.py", line 4, in
use_setuptools()
File "/home/pi/Adafruit_Python_CharLCD/ez_setup.py", line 128, in use_setuptools
return _do_download(version, download_base, to_dir, download_delay)
File "/home/pi/Adafruit_Python_CharLCD/ez_setup.py", line 108, in _do_download
_build_egg(egg, archive, to_dir)
File "/home/pi/Adafruit_Python_CharLCD/ez_setup.py", line 57, in _build_egg
with archive_context(archive_filename):
File "/usr/lib/python2.7/contextlib.py", line 17, in __enter__
return self.gen.next()
File "/home/pi/Adafruit_Python_CharLCD/ez_setup.py", line 88, in archive_context
with get_zip_class()(filename) as archive:
File "/usr/lib/python2.7/zipfile.py", line 770, in __init__
self._RealGetContents()
File "/usr/lib/python2.7/zipfile.py", line 813, in _RealGetContents
raise BadZipfile, "File is not a zip file"
zipfile.BadZipfile: File is not a zip file
this happens because for some magic reason :) the python script screw up the download of a zipped file.
In my case the file was setuptools-3.5.1.zip.
Doing an ls -l showed up to be 122 byte big !! Definitively NOT a zip file.
The workaround was quite easy actually.
The workaround was quite easy actually.
- remove the file : sudo rm setuptools-3.5.1.zip
- manually download the file :
wget https://pypi.python.org/packages/source/s/setuptools/setuptools-3.5.1.zip - Re-execute the build : sudo python ./setup.py build
Examples
Be aware about the type of kit you are using.
On the examples area there are different examples depending the type of display in use.
To test the basic display, use : char_lcd_mcp.py
To test the kit with RGB display and pushbutton use : char_lcd_plate.py
Wednesday, October 8, 2014
Airflow sensor test
I used a little board with a MSP430-2013 and a LCD display to develop the basic code to test and read the airflow sensor.
Here a picture of the prototype
The MSP430 pin connected to the airflow sensor is set in interrupt mode (rising) and after a check on the pin state to be sure is not a spike, a counter is incremented.
Every time a related timer expire, the value of the counter is copied into another variable (to be displayed) and the counter is reset.
I use another timer to display the read value on the display, after a integer-to-ascii conversion.
The code described is not reading the DS1820, only the airflow sensor.
The circuit
Here a picture of the prototype
The software
The airflow sensor reading is based on counter and a timer.The MSP430 pin connected to the airflow sensor is set in interrupt mode (rising) and after a check on the pin state to be sure is not a spike, a counter is incremented.
Every time a related timer expire, the value of the counter is copied into another variable (to be displayed) and the counter is reset.
I use another timer to display the read value on the display, after a integer-to-ascii conversion.
The code described is not reading the DS1820, only the airflow sensor.
TeirmiLab - prepare Raspbian
For the TeirmiLab project, one of the platform I choose to prototype it, is the Raspberry Pi B (or B+).This is a quick step-by-step reminder about how to prepare Raspbian for the Raspberry Pi B and B+ for this project.
There are on-line hundreds of places where is described how to install a Raspbian over a Raspberry Pi.
If this quick step-by-step is not enough for you, try this.
If you think that this is too technical ... are you sure you want to play with microcontrollers ? :)
Lets start.
I used a 8 Gbyte micro SD card with a low profile adapter. In this way is easy to eventually swap to the Raspeberry Pi B+.
It is necessary, at least for the installation, to have :
- a 5 Volt 1A USB power supply
- a USB cable (microUSB) for the power supply
- an internet connection, better if wired
- a computer (needed to download the image and prepare the SD card)
Optionally if you want to enable the graphic interface or plan to use Noobs, better to have also:
- a HDMI monitor or a composite monitor (suggested an HDMI one)
- an USB keyboard
- an USB mouse
As keyboard and mouse, I used a wireless Logitech keyboard with an included touch-pad with USB dongle, in this way there is still available an USB Port.
SD card preparation
Once all the HW components are available and connected, is possible to prepare the SD card.Raspberry Pi does not have flash, it boots from the SD card that is used also as hard drive.
Because of that it needs to be formatted in Fat32.
Using kparted erase all the data on the SD card (new partition) and then simply format all the card in Fat32.
If you DON'T plan to use Noobs, there is no need to format the SD card.
Problems
Use a decent SD card for the job.
It should be fast and good quality/brand.
I had some SD cards not working properly because not fast enough or bad brand.
I found more reliable to use microSD cards with the adapter.
Installing distribution
There are two main choices about installing a distribution/OS on the SD card:- installing Noobs
- installing a specific distribution
If you choose to use Noobs, here some notes.
It is easier, shows you the latest available distributions and install automatically everything needed.
You must connect an HDMI monitor and a keyboard/mouse to the Raspberry Pi.
To install Noobs, simply download it and extract it on the SD card.
That's it. No strange formatting of the SD card, no partitions, secret code, ecc.
Just a plain copy.
Once copied, insert the card on the Raspberry Pi and turn it on.
After few seconds will appear on the HDMI screen the list of available OS to install.
If you have enough space on the SD card, it is possible to install more than one.
With 8Gbyte SD card, generally there is space for 1 or 2 OS.
The suggested distro to install is the Raspbian , accessible via the Noobs menu.
It is a Debian based distro and is probably the most used.
Once installed, a configuration menu' will allows to set up some parameters, like starting the distro in graphic mode rather than command line.
The default is command line ! So it is normal to boot in command line if no configuration modifications are made.
Raspbian
It is possible to install directly Raspbian. The main advantage is to have much more space on the SD card.
Here how to do it.
Go on the Raspberry Pi website download page , locate the Raspbian image and download it on your computer (look for Operating Systems Images - Raspbian).
Detailed explanations about how to do that are available on the Raspberry website, shortly here a quick reminder. I'm using Linux and I'm assuming you KNOW how to work on Linux.
- download the image on your PC
- extract the image from the zip file
- open a terminal
- df -h
to see what memory devices are present - insert the new SD card
- df -h
identify the latest device inserted - ignore the partitions, we need to overwrite the entire card with the image
If nothing appears, try with gparted or kparted to identify the new card - umount /dev/sdxx
umount the device added if for any reason it was mounted.
In case the card has more than one partition, umount all of them.
Eventually better reformat the card with gparted so to have a single partition but is not necessary. - copy the entire image downloaded on the sd card with the command:
dd bs=4M if=name_image_downloaded.img of=/dev/sdx
where name_image_downloaded is the path/name of the downloaded Raspbian image and sdx is the name of the unmounted device (DEVICE ! NON PARTITION !)
CAUTION! Take your time and triple check ! If you use the wrong /dev you can lose your data !
At this point you have the SD card ready to be inserted in the Raspberry Pi.
Do it, be sure to have connected the board to the network, no need to have HDMI and keyboard/mouse, you can operate via ssh.
The image installed allows for the default user named 'pi' and password 'raspberry'.
Hook up a terminal to the board, for example in ssh, is possible to login with:
- ssh pi@192.168.xxx.xxx (address of the board - see your DHCP assignment)
- password : raspberry
Do it, be sure to have connected the board to the network, no need to have HDMI and keyboard/mouse, you can operate via ssh.
The image installed allows for the default user named 'pi' and password 'raspberry'.
Hook up a terminal to the board, for example in ssh, is possible to login with:
- ssh pi@192.168.xxx.xxx (address of the board - see your DHCP assignment)
- password : raspberry
Once gained access, is better to do an update with : sudo apt-get update
After the reboot is better to configure Raspbian running the command sudo raspi-config.
At least run the option
- Expand Filesystem and the
- Advanced Options/A6 I2C in order to enable the I2C support.
No need to run other options.
The Raspberry Pi B (or B+) board is ready for the next step.
At least run the option
- Expand Filesystem and the
- Advanced Options/A6 I2C in order to enable the I2C support.
No need to run other options.
The Raspberry Pi B (or B+) board is ready for the next step.
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.
The TeirmiLab should be able to performs these functions (the list has no particular priority)
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.)
The alarm can be visual (change color of the display for example), audio (buzzer) or web based (browser pop up).
The thermometer should be placed away (inches) from the source to measure so to easily locally display the temperature on a local display
So a mini keyboard with at least three pushbutton is necessary.
Alternatively is possible to use a rotary digital encoder with a pushbutton.
Here a button requirements:
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.
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.
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
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.
Subscribe to:
Posts (Atom)








