Serial in the cold

Simmicht

Senior Member
Here in Australia, middle of winter and it is getting cold in the shed, about 12deg C. Too cold for a Cleverwatts meter to talk at 57600 baud to a Picaxe 28X2 with a 8Mhz resonator. As soon as the shed temperature comes back up above 12 deg C, communications are all good again.

How do I auto adjust the HSERSETUP B57600_32,%111 command to allow for the frequency shift of either the picaxe of the watt meter?

I also have picaxe data going back out another pin to a xbee, so I dont wish to slow or speed up the picaxe too much.

Will the CALIBFREQ command work after SETFREQ EM32 ?
OR should I add or subtract from the B56700 value of 138?

HSERSETUP 130,%111 perhaps?

Thanks
 

MFB

Senior Member
Auto adjust may not be necessary. It could be that the normal frequency match at either end of the serial link is just on the edge when above 12C. Try replacing the resonator with a crystal.
 

srnet

Senior Member
Have you tried 38400 ?

At 8Mhz and 57600, my 18F25K22 complier reports a 3.55% error in the baud clock, but its only 0.15% at 38400.

HSEROUT is using the same UART hardware on the PIC, so maybe has the same clock error.

3.55% ought not to be a problem in itself, but if the other end clock is out as well, then maybe the combined error makes it go wrong.
 

Technical

Technical Support
Staff member
As you suggest, the baud rate can also be tweaked, as B57600_32 is just a predefined number - you can use your own number instead.

Try this in the simulator

do
w0 = b57600_32
loop

to find the constant value (138). They try tweaking it up or down a bit e.g.

HSERSETUP 137,%111
 

Simmicht

Senior Member
TIC ... for us Aussies 12C is getting down there.
Annoying story time, when I was a school boy here is Queensland counrty, we had a art teacher on exchange from England, anf she complained she had never been so cold as she was here that winter, becaue our houses are built to be cool in summer and we just have to put up with the cold for the 6 weeks of winter we get.

The Baud rate is determined by the WattsClever ENVI device and I cant adjust that.

I tried varing the value for HSERSETUP from 138 (predefined value) to 128 to 148 and it didnt seem to find a value that worked.

I will try a larger range and see if that will work.
 
Last edited:

srnet

Senior Member
That its so temperature sensitive suggests the baud rate is only very slightly out.

Serial does allow for a few percent variation in the clock, and I am surprised a PICAXE with a resonator is far enough out to cause problems.

Its at times like this that a scope is so handy ........
 
Last edited:

BillyGreen1973

Senior Member
For something to be that sensitive to temp. I would start to look at things like broken wires only just making a connection, tarnished plugs/sockets, reseating chips etc.
It seems to me that as the temperature drops, the components/cables etc, contract and break the connection on the serial comms. Even 'dry' solder joints can cause this wierd behaviour, I'd eliminate these possibilities first.

12°c is not that cold in the grand scheme of things and PICAXE etc, should run happily at this temperature, I've had a picaxe running in the freezer down to -5°c, using 'serout' to an LCD showing temperature, with no problems on the picaxe side (LCD wasn't too happy at being in the freezer:D), so I think other things are happening here other than the picaxe not liking the cooler temps.
 

srnet

Senior Member
Are you really sure the PICAXE is running on the reasonator, this sort of issue is far more likley to occur if the PICAXE is running on the internal clock, if the problem actually is to do with the baud rate.
 

hippy

Ex-Staff (retired)
There seems to be an assumption here that because the comms appears not to be working below 12C but does above it's a result of a baud rate variation issue but that doesn't have seem to have been proven.

As noted, serial should be tolerant to around +/-5% baud rate error and 12C isn't a low enough temperature where it would be expected for odd things to happen or baud rates to change drastically, internal resonator or not ( either meter or PICAXE ).

The best course would be to look at the signal on the scope, see what it is doing. Is it even present below 12C ? Could it be the PICAXE program doing something wrong when the temperature drops below a certain level ?
 

MFB

Senior Member
Further to hippy's comments, is the signal level from the meter effect by temperature? My be its on the edge above 12C but falls outside the the PICAXE reception range below that temperature. However, my bet is still baud rate timing drift.
 

Dippy

Moderator
Suppost the baud 'frequency' was off by 3% at room temp and the reduction to 12oC knocked it by 2%. Bingo. ;)
As an aside; I must say I have scoped some significant timing discrepancies with untwiddled INTOSC and soft serial.


As hippy says ; A 'scope is the tool for the job rather than the guessoscope.
Nail each element of the problem and get a result.
If you don't do this you may find yourself barking up the wrong tree.


Please can we say 12oC, I kept reading all this as I2C.
I know it saves you keyboard Ninjas a millisecond but it's confusing my poor brain.
Or reclaibrate your thermometer so it is 11C :)
 

Simmicht

Senior Member
It was "failing to proceed" below 11.9C (better Dippy?)
One further piece of information to all helpful souls, I disconnected the PCB with the 28X2 chip to reporgram it and when I plugged it back in, the Cleverwatts did not power up.
The ENVI is powered from the PCB via 1M CAT5 cable and RJ45 socket which only has 3 pins connected to the Cleverwatts ENVI. 3V, GND and TX.
So if the power was not getting through till I wiggled the connector, maybe the signal is simalarly affected.
I will try reseating the connectors at either end and then wait for the next cold snap.
Cheers
 
Last edited:

MPep

Senior Member
If wiggling causes a problem, then perhaps your problem all along has been that of dry solder joints. Consider resoldering connections and try again.
 

westaust55

Moderator
For those not so familiar with temperatures around Australia, Queensland where the shed is located is in the northern half of the eastern third (if that makes sends) where it tends to be warm to hot for more of the year.
The alpine region and surrounding areas experience negative temps in winter and Canberra where our federal politicians supposedly work can be darned cold (let's go no further on that topic) in winter.
By comparison a mining centre like Telfer in the North-West of WA can reach around 54C in summer (and chilly 30 mins) on the same day - similar to what can be experience near the coast in Saudi Arabia.
Islands of the Kimberley coast might see a max in summer of 35C and a winter min of 15-20C in winter.
So as can be seen, it is all relative as to what is hot or cold.
 

Simmicht

Senior Member
I have feeding to pachube, data coming live from PicAxe chips.
http://pachube.com/feeds/3037

You can see the shed temperature there.

It went off again last night. I fiddled the connections but to no avail. I did note that that resonator is about 5mm from the LM7805 and that regulator was nice and warm, not too hot to touch but about 35-40C. So now I am suspecting the ENVI unit itself.
 

Dippy

Moderator
Aha.
Time for more experiments then;
ENVI in fridge wired to PICAXE circuit outside.
Vice Versa.
Both in fridge.

This is where a 'scope can save days. There are a number of variables that you have to test I guess.
Got any freezer spray?

Sounds like you have a pile of experimental work to do.

PS. 11.9C is much better :). 11.9oC is even better though I appreciate the extra work. To keyboard experts: Can we do a real degree symbol easily?
 

eclectic

Moderator
snip
PS. 11.9C is much better :). 11.9oC is even better though I appreciate the extra work.
Can we do a real degree symbol easily?
A bit of a hassle to set up, but then OK:
In Windows System tools, find
Character Map.
Attach to Taskbar.

Select then copy/paste.
For example

11.9 °C
300 Ω

Ǝ
 

BillyGreen1973

Senior Member
using

ALT+248
is easier for ° symbol :)

Some useful 'alt' codes I keep in notepad.

® alt+0174
µ alt+0181
© alt+0169
° alt+248
Ω alt+234
™ alt+0153
 

manuka

Senior Member
Aside from that blast in the fridge, it may also be worth using thermal insulation on critical circuitry. Crystal ovens have long been used for commercial transmitters, & I've heard of oscillator circuits etc being inserted into a small (glass walled) thermos for thermal stability. Given the Oz. conditions ( brrr- it's warmer over here in NZ!) perhaps just a polystyrene foam (or bubble wrap) "blanket" may be enough.

Stan. (mid winter Wellington-NZ & still growing tomatoes in an unheated greenhouse)
 

MPep

Senior Member
Given the Oz. conditions ( brrr- it's warmer over here in NZ!)
Stan. (mid winter Wellington-NZ & still growing tomatoes in an unheated greenhouse)
Well Stan, that all depends on where you are in NZ. A bit colder down Christchurch way! :eek:
 

geoff07

Senior Member
It is 14 degrees now in Cheshire, UK, at 0930 and was probably 12 earlier this morning. In mid-summer. Where's my coat?

All your key parts will be specified for 0-60 deg at least, probably better. The only issue I can think of, assuming no mechanical problem, would be possible condensation. QED, probably mechanical - plugs, soldering, bad cable - all potentially temperature-sensitive.
 
Top