Did you know...
|
|
Robbert van der Bijl's Serial Wombat Bathroom Display

This Display Shows How Much Solar
Heated Water is Available
This article is the first of what I hope will be a series
of user articles on actual user applications of the Serial
Wombat. When Robbert told me about what he was doing, I begged
him to do a write up and take some pictures. As a gesture of
gratitude I sent Robbert an assortment of items Serial Wombat
keeps in stock, including a special edition, Serial Wombat
Red-Label, which is only available to users who have projects
featured on the site. Obviously, the effort users put into these
projects far outweigh the value of anything I send them, but I
want to make sure they understand how grateful I am for their
allowing me to feature their projects. If you have a cool Serial
Wombat project you'd like to see featured, contact me!
-Jon

Limited Edition Red-Label Serial
Wombat. Submit an article to get one.
Robbert was kind enough to share his C# source code. Grab it here...
I have a subscription to the AllElectronics.com newsletter and
something caught my eye a couple of months ago. Cool looking LED
displays for a buck! I looked at the interface and wasn't sure
how to deal with that until I saw Jon's post on the website,
which lead me to the Serial Wombat website. Once I figured out it
was relatively easy to control these displays with the Serial
Wombat that Jon is selling, I decided to buy 6 of them (I was
sure I was going to blow a couple up :) ). Of course, I also
bought the Serial Wombat starter kit and started playing with it.

Robbert is running RS-232 though the
house over CAT-5 from his server to a Serial Wombat
I have a solar hot water system in my home, and something
that's always bugged me is that I have no idea when I'm in the
shower how close I am to getting cold instead of hot water. :)
Those tanks seem to run out immediately and there is no real
warning. Quite a bummer when you're standing there with shampoo
in your hair... Of course I also have a backup hot water system,
but I need to twist some valves to enable that. So I've been
looking for a display solution that would work in the bathroom
(water tight etc.) and be easy to control. I already log
everything related to the solar hot water system to a SQL
database on my home server, and have a couple of terminals in the
house displaying trends and performance. Unfortunately those
solutions don't really work well in a bathroom. So the LED
display was a perfect candidate.

Lots of IO left for the future...
My whole house is already wired with CAT-5, so
I was hoping to drive the LED displays over the SPI bus from the
basement of my house. That proved to be impossible, as the SPI
bus didn't really appreciate being stretched THAT far. So instead
of doing that, the Wombat is now in my attic, getting RS232 from
the server over that same CAT-5 cable, and having 6 foot runs to
the displays in both my bathrooms. That seems to work well! 

The software driving this is written in C# as a System Service
(so it has no UI front-end). It writes certain issues and debug
status to the event log on the server. Eventually I intend to
modify the Pin Mode SDK sample that Jon wrote to take data from
the user memory and cycle through the messages automatically. So
the server only needs to send the data over RS232 periodically
and is not responsible for updating the display directly. Right
now if you look closely you can almost see the display being
built-up in parts (9600 baud and 5 8-byte messages). But that's
another project for another time. :)

For now, the application gets data from my SQL database at a
set interval and cycles through the different status displays. Of
course, most of this is still a work in progress, so the code
isn't as clean as it should be, but it IS working!
For more information contact:
Robbert van der Bijl
Note: To keep Robbert from getting spammed, I've left his
email address off. Use the Contact page on this site to Contact
me, and I'll put you in touch with Robbert. -Jon
Below is some of the correspondence between Robbert and I
about this project. Used with his permission.
Hi Jon,
I just got the Wombat in today! Thanks for the quick shipping!
Funny enough, I had already bought 5 of those LED displays from
AllElectronics, intending to control it using your Wombat! :) But
thanks for including the extra one! You never know!!
I also got the USB PIC development board from Sparkfun, figuring
that would be a relatively easy setup to start
"playing" with. I just hooked it up (with nothing else
but the Wombat on it), and I got the BOOT> prompt. So I
suppose pin 6 needs to be tied to +5V.. :) I'll figure all that
out this weekend when I have a little more time.
I'm definitely looking forward to giving this guy a spin! I've
been a C++ developer for high level SW for a while now and am
looking forward to doing some more low-level stuff for home
automation-related stuff! If all goes well, the Wombat will be
controlling 2 hot water valves and reporting on the temperature
and status of my solar collectors using a couple of the LED
displays like the one you included....
Thanks again,
Robbert
From: Jon Broadwell
Sent: Thursday, May 01, 2008 8:57 PM
To: Robbert van der Bijl
Subject: Re: Home Automation, sparkfun USB, C++ and the Serial
Wombat
Great! That sounds cool. A lot of people buy it "Just to
play with", as opposed to having a specific problem to
solve. If you get your project working, I'd be happy to send you
another accessory kit & chip in exchance for a few pics and a
few paragraph write up. I'd like to show on the web site that
real people in the real world really are doing stuff with this.
I'll also provide a link to your site, resume, facebook page, etc
if you'd
like some publicity.
Are you developing under windows? I tried for a while to get a
good COM port connection using C++, but found that a very tough
nut to crack. I basically gave up and went to C# / .Net (which
has a wonderfull class for the serial port...)
I'm also working on a new pin mode which can send all the other
pins to a default state if it doesn't receive an "OK"
signal from the host every XXX milliseconds. It's designed for
applications, perhaps like yours, where you wouldn't want to
accidentally leave a pump / valve / heater / motor / etc
energized forever if your computer side software crashed. Let me
know if you have any feedback on this, I'd value how this might
be useful in your home automation apps.
Have fun,
Jon
Hi Jon,
I brought the Wombat and the Sparkfun unit to work with me today
and played with it a little bit. For some reason I kept getting
the E_BOOTE> prompt when I started up, regardless of whether
pin 6 was pulled up or down. So I decided to get the latest
firmware from your site and update it. That seemed to work, and
now I managed to get some text onto the display by using
232Analyzer (great tool for doing low-level RS232 stuff!).
I'm back home now and figured I'd try to hook up the LED display
to this same rig, which seems possible from the documentation
that I read (the pins I need to use are not in use by the
built-in LCD display or anything else).
But then I ran into a small snag.. I wanted to pick up the latest
wombatpanel from you so I can download the BIN files to the
Wombat to be able to do the PIN mode with the LED display.
Unfortunately the link to the latest rev appears to be broken.
And since I run Vista x64 at home I have no Hyperterminal and no
handy XMODEM protocol (without digging out the old Telix or
similar DOS app... :)). So if you are able to send me the correct
link to the latest wombatpanel, that would be very helpful! Bear
with me, since I'm a beginner in this field, but somewhere in
your instructions for the LED pin mode SDK you talk about loading
the BIN at address C000. I frankly have no clue where to set the
load address. Does that happen in the MPLAB IDE somewhere? Or is
that something that happens automatically?
To get back to your email.. I'd be more than happy to get you
some pictures and a little write-up of my crazy project here. :)
I've been doing home automation since I got my solar panels
installed a couple of years ago, and was frustrated that the
controller that came with it didn't have any USB/serial hookups.
So I got a USB LabJack (www.labjack.com) and created a C++ app
that sampled the analog channels from the RTD's and that way I
was able to keep track of the temperatures and display them on a
PC upstairs. That grew into adding 1-wire Sensirion temp/humidity
sensors around the house for ambient temperatures and then to a
monitoring device for power use, and some more RTD's around my
hot water system and furnace to monitor efficiency and stuff. I
now have about 1/5 yrs of complete data for my power, water and
oil use. It's definitely helped in cutting out some energy
wasters, which is what the driving reason behind all of this was.
Recently I mixed in my X-10 lighting and some X-10 compatible
motion detectors as well. I guess you can say it's turned into an
out of control hobby. This guy in the Netherlands (www.bwired.nl)
has kinda been my example, although I don't want to go as far as
he did....
I have quite a bit of experience developing in C++/MFC under
Windows (VS6.0/VS2005). Recently I branched out to VS2008 and C#
and it seems to make soooo many things soooo much easier. But
it's also black-boxing a lot of things, and making some
statements or assignments "magical" almost. So I'm
still getting used to that. As for serial port stuff, I've done
tons of that in C++. Once you know how to do it, it's not that
bad. Admittedly, C# is less work. :) If you want, I can dig up
some code and send it to you if you need samples of serial comms
in C++.
I like your idea about the watchdog timer/state in the Wombat.
Although it might be handy to have it be a host-driven thing
through the serial port as you described, or maybe just a pin
that the wombat watches toggle every now and then. Or perhaps
have the wombat be the master and request a reply from the PC
every now and then by sending a clock "TICK" message or
something like that, expecting a "TOCK" reply.
Anyway.. I'm going to poke around with the wombat a little more
tonight and then get back to it tomorrow sometime. I really
appreciate being able to email with the "creator" of
the wombat. :)
Thanks,
Robbert
From: Jon Broadwell
Sent: Friday, May 02, 2008 7:52 PM
To: Robbert van der Bijl
Subject: Re: Home Automation, sparkfun USB, C++ and the Serial
Wombat
Link should work now. Sorry about that. I cleaned out some
orphaned stuff a while ago and must have gotten that by accident.
Wombat panel will prompt you for the address. It will suggest
0xC000 as a default.
The C++ code would be great. That would also open the possiblity
of writing an ITunes visualizer which could do a frequency bar
graph on an LCD.
I'd love that...
Keep me up to date on your progress!
Have fun,
Jon
Hey Jon,
I just downloaded it. There seems to be an issue with the
executables as they crash (both the debug and release)
immediately on my system. I opened the project to try to
build/debug it, but there seems to be some kind of password in
there (not sure why that's there or what it does). I'll look at
it more tomorrow.
I did attach a really dumb/simple serial class to my email in
C++. It needs some tweaking to allow it to send nulls, but I
haven't looked at that yet. The project around the class just
prints a simple hello on the Sparkfun LCD display. :)
I'll keep you posted. Thanks for the quick feedback!
Robbert
From: Jon Broadwell
Sent: Friday, May 02, 2008 8:29 PM
To: Robbert van der Bijl
Subject: Re: Home Automation, sparkfun USB, C++ and the Serial
Wombat
You may be the first one to try running them on x64. Dunno. I
don't have trouble running the apps, but I'm on 32-bit windows
XP.
WRT the password building thing, I've occasionally had trouble
with "Click once maifest" signing certificate under
"signing" when you right click the Wombat Panel project
in Solution Explorer and choose Properties. Try creating a new
test certificate, then rebuilding the code. I don't really know
what this is for, but I found the solution one time by googling
the error message. As I say on the web site, I'm not much of a
Windows programmer...
Hey Jon,
Turns out the issue I had was two-fold. For some reason this
project does not like living on a network drive. Secondly, there
was some sort of issue with that signing, so I turned it off. In
any case, it's working now, and I can build your wombatpanel and
run it without a problem!
I attached a picture of my progress so far! I'm very excited that
everything is going smoothly! I only spent an hour or so on it
today and I got the LED display working using the LCD Sparkfun
board. I intend to drive two LED displays off of the wombat. They
need to show identical information at all times. I assume it
shouldn't be a problem to double up the reset, sd0 and clk lines,
right? I read something about you trying to drive two LED
displays, and not being successful, but I gathered you were
trying to display two different things on those displays?

You can get this
LCD Dev board at Sparkfun.com The Serial Wombat Plugs into the
back.
I adapted my little RS232 class (which was pretty butchered to
begin with) to send null characters by passing &char types
instead of CStringA types. I'll expand this class later to
include some more wombat specific protocol things. Like
monitoring that the Wombat is responding, etc. Oh, and I also
found out that I didn't need the resync to happen between every
command, as long as I wait 10ms before sending the next command.
I haven't dug through your C# code yet, but have you ever run
into something similar?
Thanks,
Robbert
From: Jon Broadwell
Sent: Sunday, May 04, 2008 9:11 AM
To: Robbert van der Bijl
Subject: Re: Home Automation, sparkfun USB, C++ and the Serial
Wombat
Glad all is going well. You should be able to lots of displays
off the same pins, if you want them to display the same thing.
It's possible that at some point as you add displays you'll have
to slow down the data rate (this would require a recompile of the
bin) because each display will increase the capacitence on the
line (capacitence is the enemy of high speed data like what goes
into the LED clock pin).
You can drive multiple displays (see the "Serial /
Wombat" picture), but you need separate reset and clk pins
for each display (data is shared).
Can I post your picture on the Web page for the display? How
should I
credit you?
Thanks,
Jon
Hi Jon,
I haven't had a chance to play more with the displays etc. today,
but I just wanted to let you know it's fine if you want to use
the picture. You could just put in small letters under it that I
took it, but it's not a big deal.
I'm planning on driving just 2 (maybe 3) displays. The only issue
I may run into (but I'm not sure yet) is that the displays will
be at the end of a 100 ft CAT-5 run. If I have issues with the
length of the wire, I may put the Wombat closer to the displays
and use the CAT5 for RS232 instead.
I ordered a couple of things this weekend to help me complete
this project (CAT-5 jacks etc). Once I get those in, it shouldn't
be long until I have those 2 displays installed and working! I'll
send you pictures again at that point!
Robbert
Hey Robbert,
I'd be surprised if the 100 ft run works. The protocol (SPI) used
for the displays is really designed to run a few inches over a
circuit board. For a 100ft run, I'd look at using RS422 or 485
for serial over your cat 5, with a Wombat chip by the display.
-Jon
Hi Jon,
I didn't know much about the SPI protocol, but I have my
sensirion temp/humidity sensors on similar loop lengths (and I
even have some of these CAT5 runs doubling up 10/100 ethernet on
the same cable!). These sensors use a variant of an I2C protocol.
I have no idea about the frequency/speed of that protocol though.
Never had to figure that out. What is the default rate of the SPI
protocol? And how far can I slow it down? Since you mentioned it
may be a problem, I'll grab my box of cat5 cable and hook up the
display through that and test it. I'll probably do that one
evening next week. I'll let you know what happens!
Thanks,
Robbert
From: Jon Broadwell
Sent: Sunday, May 04, 2008 9:06 PM
To: Robbert van der Bijl
Subject: Re: Home Automation, sparkfun USB, C++ and the Serial
Wombat
The clock is 500kHz. Let me know how it turns out. I can make you
a slower
version if you like, assuming you have problems.
Hi Jon,
I haven't had a chance to get back to the Wombat stuff until
today. We had some family over around Mothers day.
Anyway, I just tested the Wombat with the serial display with
about (TOTAL guesstimate!) 200-300ft of CAT-5 inbetween. As you
had expected, I'm getting garbled data on the LED display. It
looks like it's getting about 10-20% of the data in correct
though when I look at some of the segments that are lit. I can
actually almost make out the text!! I also tried a 10 ft cable,
and that worked fine. No errors.
In any case, I'm thinking that a slower SPI clock may just do the
trick! I also found out that the I2C clock for the sensirion
sensors that I run here is 100Khz. So maybe if you can slow down
the SPI to 100Khz, that may do the trick! Is that something I
could do from the C program myself by the way? Or is that
firmware-related?
Thanks!
Robbert
From: Jon Broadwell
Sent: Saturday, May 17, 2008 9:52 PM
To: Robbert van der Bijl
Subject: Re: Home Automation, sparkfun USB, C++ and the Serial
Wombat
Robert,
I'm assuming you are using the SPI SDO and SCK pins, the rate is
already as low as I can go without massive changes to the
firmware. 32MHz with a 64 x divider is the slowest.
Try moving the SCK pin to another pin. This should slow things
down a bit.
If this doesn't work, we'll try recompling the code with a delay
on the Software driven spi.
Have fun,
-Jon
Hi Jon,
I moved the clock to another pin, which gave me less errors than
before, looking at the display. But it's still not error-free. Is
there anything I can do to slow down the clock signal? Or is that
buried in the SDK somewhere? I tried inserting delay_cycles16 in
the sw_spi_send code, but that did not change the data errors
(but did make the display visibly flicker; see code below). Any
other ideas? I don't have a scope here so I can't see how
fast/slow I'm really sending either (or what the signal looks
like at the other end of the cable).
Thanks,
Robbert
#define SW_CLOCK_BIT(_a) { if (tp2.phoneled.temp8 & _a){
LATCbits.LATC5
= 1;} else {LATCbits.LATC5 = 0; }
pin_high(tp.phoneled.spi_clk_pin);delay_cycles16(1000);pin_low(tp.phonel
ed.spi_clk_pin);}
static void sw_spi_send()
{
SW_CLOCK_BIT(0x80);
delay_cycles16(1000);
SW_CLOCK_BIT(0x40);
delay_cycles16(1000);
SW_CLOCK_BIT(0x20);
delay_cycles16(1000);
SW_CLOCK_BIT(0x10);
delay_cycles16(1000);
SW_CLOCK_BIT(0x08);
delay_cycles16(1000);
SW_CLOCK_BIT(0x04);
delay_cycles16(1000);
SW_CLOCK_BIT(0x02);
delay_cycles16(1000);
SW_CLOCK_BIT(0x01);
}
From: Jon Broadwell
Sent: Saturday, May 24, 2008 7:55 PM
To: Robbert van der Bijl
Subject: Re: Home Automation, sparkfun USB, C++ and the Serial
Wombat
That would have done it, I think. Did you get a successful
compile and create the new .bin file and all that? I have to say
I feel good about that. You're the first customer I know of using
software in the field.
The problem you hit on is the big one. At some point we drive it
so slow that we can see the individual segments turning on and
off, and apparently that's still not quite good enough because
you see errors. I hate to say it, but I think you're going to
have to get a shorter wire between the Microcontroller and the
Display. I don't see any additional tricks we can play that you
haven't already. As a last ditch effort, try adding 10k pull up
resistors between the +5v and the clock and data line near the
display. That may clean up the rising edge a little bit, at the
expense of the falling edge (which is usually better). But I
woudn't get my hopes up...
-Jon
Hi Jon,
Summer has come, and so have the chores around the house and
outside...
So less time for hobby work unfortunately!
To answer your questions though, yes, I did get a successful
compile. I also ended up borrowing a scope from my office and
looking at the signal at the end of the wire. It was horribly
deformed. An edge was followed by many high amplitude
oscillations, both on the rising and falling edge. That pretty
much confirmed for me that I can't do exactly what I was trying
to do..
I did test 9600bps serial through TWICE the cable length. And
that worked fine!! So instead of having the wombat in my
basement, I'll mount it inside the electrical box in the attic or
in one of the bathrooms and slave one or more LED displays off of
that unit. Those cables would be relatively short (maybe 6-10
feet). Those lengths have shown to work ok.
So all of this means I will need another wombat since the one I
have I would like to keep with the LCD display unit for testing
etc. Does your offer for a free or discounted Wombat chip still
stand? In return for pictures & an article?
Thanks!
Robbert
From: Jon Broadwell
Sent: Monday, June 09, 2008 6:15 PM
To: Robbert van der Bijl
Subject: Re: Home Automation, sparkfun USB, C++ and the Serial
Wombat
Sure! Send me a few pics and a write up of what you've done, and
explain a little about the problem you're solving. It doesn't
have to be long or formal. Some source code is nice too, but not
required. I'll send another chip out on receipt!
Hi Jon,
I appreciate that! Im still working on the project. I have
the Wombat and serial interface soldered, tested and ready on my
own circuit board. Now I need to start cutting holes in the wall
and mounting this stuff. I have taken plenty of pictures already,
and will do a nice writeup when things are ready. Hopefully it
wont be too hot in the attic this weekend so I can drill
the holes and run the wiring.
I was wondering about something though.. Have you ever tried (or
do you know of anyone who tried) to hook up a DS1722 to the SPI
interface? The DS1722 is a SPI compatible temperature sensor. Or
have you tried a DS1620 (same thing, but then 3-wire protocol). I
would like to add some more temperature sensors to my home, and
the SHT-71 (Sensirion) that I have been using so far with my USB
Labjack interface have been working great, but theyre $27 a
pop.. PFEW! The 1722 can be had for a few bucks.. And since
Ill have a wombat in the attic, it would be SOOOO nice to
have it do the data acquisition and send the data back through
the serial interface
Thanks!
Robbert
From: Jon Broadwell
Sent: Wednesday, June 25, 2008 4:46 PM
To: Robbert van der Bijl
Subject: Re: Home Automation, sparkfun USB, C++ and the Serial
Wombat
I haven't tried that particular part, but take a look at the SPI
master pin mode. It should work with just about any SPI device,
as long as you get the polarity / clocking / etc. right.
Hi Jon,
I looked at the SPI master mode, and Ill probably buy a
couple of the DS1722s when I get this part of the project
done and I can experiment with those on my 2nd Wombat. :-) As for
the SPI bus, if I wanted to connect multiple DS1722s, I can
connect all of them to the same data & clock lines, but I
have to run a separate chip-select line for each one, correct?
Thanks!
Robbert
|
|