Sure Electronics DC-SS500
(stuff i've discovered)
last updated April 24, 2014
|Overview||I bought one of these modules for a project where i have a PC and a NAS in my loft... It gets kind of warm, and kind of cold up there, but by how much i didn't know. I don't want to set my house on fire, or roast my equipment so i decided to see if i could make a small temperature (and humidity) logger, or at least see the results remotely.|
|Aim:||Hardware : I have a PC running Linux, my idea is to have a shell script that can query a sensor in the surrounding environment every little while and log the results to a html page running on a web service so that i can view this on my home network when i want to.|
Get a temperature sensor that i can query through a shell script in Linux. The easiest way to do this is to use RS-232 (its an old P3-800 with serial ports) for comms.
Almost everything on the market you find is either a semi-active or passive device. The only communicable devices or modules use SPI, I2C or other one-wire serial protocols which is fine for micro-controller projects, but seeing as i want this to be Linux-readable, i need something that "talks like what a PC does guvnor" so RS-232 in other words.
|Step 2:||So i find the Sure Electronics DC-SS500 Temperature and relative humidity sensor module on eBay for not a lot of money. It not only does temp/humidity, but has analogue voltage sensor outputs, an SPI interface as well as a UART (serial!) interface. There are three ways to read the temp/humidity, so i must find some success with this one surely..|
|Step 3:||well, follow the instructions as set out in the manual and see what you get.|
|I had some issues with a misunderstanding of TTL and RS-232...|
|How to make it work!|
|Step 1: POWER UP!!||
First of all, hook up power
to the right pins, you need to put :
|Step 2: Connect
to a PC
hook up the UART comm pins to your PC's serial (RS-232) port. This isn't as easy as it sounds. I got stuck at first because i had not realised that the TTL serial UART on the temp sensor is in fact inverted with respect to RS-232.
So you'll notice the inclusion of a 74ls04 (hex inverter) this will make the module readable and controllable by the PC.
Also you'll notice that i have tied /CS (pin5) high, this is very important, if left floating the module will only randomly answer your comms! This is also NOT documented as a requirement for UART support!
Because this is only a 5v device, its not wise to wire this straight up to a 'standard' RS-232 device, instead you need to convert the normal RS-232 voltages (+/- 15v) to something that both devices can work with without frying each other, this is done with the 3 resistors acting as a basic divider and a limiter shown. This would also allow you to communicate serially with other low-power microcontrollers if you wished, but watch out for inversion.
|Step 3: Communicate!||
So, you fire up your favorite terminal program, i like to use Putty as its very powerful when it comes to seizing the com port from windows.
You start plugging in the commands that the datasheet says should yield results, and all you get is 'bad command!' every 18 or so characters that you type.. What gives?
The problem here is that the module expects a whole string sent with a carriage return in one go, you can't send a single ASCII character at a time, there appears to be no buffer on the interfacing PIC on the module.
Time to abandon the terminal program for now...
On my development PC in my workshop I'm using WindowsXP, so the easiest way to send a string out is in DOS mode (command line in other words)
make sure you setup your
mode properly so that the command line knows how to setup the port with
|Step 5: communicating
with a terminal
The above exercise was using my Logic Analyzer so i could see just what the heck was going on... you probably don't have that luxury, so a terminal is going to be your best option to get the results displayed back to you.
I'll describe what to do with Putty,other terminal programs will vary and you'll have to work that out.
essentially, in the configuration
screen in putty, under terminal, you need to set :
|And that's about it! now you are free to communicate with the module over the serial port of your PC, remember the tricks used here to make your batch files or shell scripts work properly with this module!|
|Why do i just
see garbage in the terminal window when i mash the keyboard?
||The module is saying to you 'Bad Command !' but the TTL level is still inverted and as such this is what the inverted binary of the string 'bad command' looks like when translated into ASCII codes! You missed step 2 out, or you did not hook up the inverter properly.|
|Why do i always
get the response
|This indicates that module just doesn't know what you're saying, check that your PC serial output is inverted properly, or that you are using the correct syntax as defined in the user manual on pages 5+6.|
|Why do i always
get the response
|This indicates the module can at least see what you are sending it, if you started the command with $sure the module can at least see and understand that, but it doesn't understand what follows, this can be because you don't have the correct command followed immediately by a <LF> (line feed). type $sure status then immediately hold Alt and press 1 then 0 - then hit enter.|
|Why can't I get any response from the module at all ?||have you checked that you have tied pin 5 high? (to +5v) if this connection is broken, the module will respond erratically. If you reconnect the /CS line, don't expect the PIC to still behave itself, you need to power-cycle the module and bring it back up with /CS held high.|
|I love the page! But what is a UART? What is serial? What is a terminal? I want to build this but don't know how!||If you can't work out what's going on from this page laid out above, i think you need to learn a bit more about the basics of electronics and/or PC control, that is beyond the scope of this page... google is your friend, you can learn anything on the interwebs!|
|Can you help me solve my project idea that i have in my head?||For a fee, yes, contact me :)|
|LOFT MEASUREMENTS||And here is my
page up and running!
the module described above has been used to create the real-time page you see here!
|A WEATHER STATION||I found this page while browsing for information on data logging, the guy uses the same PIC platform that I'm used to and has documented everything very nicely indeed.. You can learn a lot from this page alone! This is what happens when you take that datalogging idea to the furthest extent! excellent stuff.|
|SURE ELECTRONICS||Supplier of the DC-SS500|
|ARDUINO SERIAL CODE||This guy used an arduino to read off the values over the serial, doesn't seem to have had any polarity issues like me!|
|send me your links!|
BACK TO MAIN SECTION