Realtime speaking thermometer

Pauldesign

Senior Member
Hey Folks,

Getting bored during the Easter break, i've been thinking of designing a causal speaking thermometer using the DS18B20 chip and SPE030 TTS module (i know is obsolete now but i managed to get the very last (sexy female voice one ).:D

My idea at present although feasible but clumsy and cumbersome, is to create a loop-up table of temperatures values between -20 and +125 deg Celsius in increment of 1 deg and stored on a 20x2 PICAXE memory.

Whereby temp will be read using the readtemp command and stored in a variable and later compared with the stored temp values on the PICAXE 20X2 and if a match exist, the temp numeric value will be sent via I2C to the SPE030 and be spoken. There is no doubt that the above method will work.

But is there a better or elegant way (without comparing the read temp against pre-stored temp values in a loop-up table) whereby the temp value acquired can be instantly (on the fly) sent as numeric or text to the SPE030 without intermediate comparisons.

I also thought of using the BCDtoASCII commands but in the end will be boils down to the same method as mentioned above.

Dough fighting over spilled milk, it would have been nice if the SPE030 was somehow able to indirectly translate values stored on memory locations rather than only translating direct alphanumeric strings sent to it. :)

Nevertheless, any other non out of topic thoughts are welcome.;)

Cheers
 

hippy

Ex-Staff (retired)
My idea at present although feasible but clumsy and cumbersome, is to create a loop-up table of temperatures values between -20 and +125 deg Celsius in increment of 1 deg and stored on a 20x2 PICAXE memory.
I'm not sure why you would need a lookup table as the DS18B20 returns results as degree centigrade, and you can split that up into component digits using BINTOASCII for sending to the speech module, for example ...

ReadTemp pin, b0
BinToAscii b0, b3,b2,b1
Select Case b0
Case < 10 : SerTxd( b1, CR , LF )
Case < 100 : SerTxd( b2, b1, CR , LF )
Else : SerTxd( b3, b2, b1, CR , LF )
End Select
 

Pauldesign

Senior Member
Thanks for the reply Hippy.

The reason i needed a look-up table is because i thought the SPE030 will only understand and hence translate direct texts and or numerals sent to it.

e.g if the instant temperature read and stored in b0 was 20 degs;

I thought sending the temp value in b0 as #b0 to SPE030 via it I2C port using the serout command syntax will be translated and spoken as hash b zero rather than the actual value of 20.

That is why i thought by using a look-up table, if a temp of say 20deg is read, it should be compared against say a 20 stored in memory, which will branch the program to a subroutine to send a direct numeric or string value of 20 (which i assume the SPE030 only understands if send this way and not otherwise).

Using the case method as mentioned by you seems efficient than the lookup table method but will the SPE030 be able to interpret the stored temp values if indirectly send to it in the form of variables (b0, #b0 etc) instead of direct plain text or numerals. ("20", "twenty") by using the serout command.

Well, if the SPE030 can understand and translate #b0 (say a temp of 20degs stored in b0) and speaks it as 20 degs instead of hash b zero; then great as that is my main worry. Please confirm, as i'm a bit busy to physically experiment. :D

Thanks once more.
 

hippy

Ex-Staff (retired)
It's been a while since I used the SPE030 but from the manual, to get it to say "PICAXE", the following can be sent ...

writei2c 0,(0,0,5,3,"pickacks",0)
writei2c 0,(64)

I would therefore assume that the following would work for saying the temperature ...

ReadTemp pin, b0
BinToAscii b0, b3,b2,b1
Select Case b0
Case < 10 : writei2c 0,(0,0,5,3,"Temperature is ",b1," degrees",0)
Case < 100 : writei2c 0,(0,0,5,3,"Temperature is ",b2,b1," degrees",0)
Else : writei2c 0,(0,0,5,3,"Temperature is ",b3,b2,b1," degrees",0)
End Select
writei2c 0,(64)

Using #b0 would work if it were supported by I2C, but it isn't, and putting that inside the quotes probably would say hash-bee-zero. You have to split a number into component digits and BINTOASCII is the easiest way to do that.
 

westaust55

Moderator
HI2COUT sp03_cr, (0, 0, 5, 1, "21", 0)

will say "Twenty One"

b20 = "1"
HI2COUT sp03_cr, (0, 0, 5, 1, b20, 0)
will say "one"

b20 = "2"
b21 = "1"
HI2COUT sp03_cr, (0, 0, 5, 1, b20,b21, 0)
will say "Twenty One"


b20 = 21
HI2COUT sp03_cr, (0, 0, 5, 1, b20, 0)
results in no audio output from the SPE030

and
b20 = 21
HI2COUT sp03_cr, (0, 0, 5, 1, #b20, 0)
results in a PE syntax error
 
Last edited:

westaust55

Moderator
Then again you can always program the SPE030 internal messages using the software from the Rev Ed website.
SPE030 Configuration software is towards the bottom of the rev Ed Software page

Have messages like
"teen", "twenty' "thirty", "forty", etc . . . to "ninety", and "hundred"

then your program code can extract the decade and say the desired hundred and/or tens followed by "1" through "9"

You will need to use a serial to stereo cable and connect to the RS232 connections to save these pre-programmed messages.

Have done such things in the past but not of recent.
 
Last edited:

Pauldesign

Senior Member
Thanks for the replies Hippy and Westaust55.

Using #b0 would work if it were supported by I2C, but it isn't,
As u mentioned Hippy, I can see it's really a while u last used SPE030, as it does support I2C interface.

Well, i'm familiar with the use of SPE030 and last year, i've used the serial, parallel and esp the I2C interface to send text and numerals on the fly and it works great.

Just to clarify my question, my main uncertainty was if the SPE030 will in real time instantly speak (translate) different temperature value (say 20) that will be continuously acquired and stored in a variable (say b0) and NOT the variable name; if a b0 variable value of say 20 is sent to it in the form of say #b0 or b0 (which ever works) instead of the actual value (20).

What i'm mostly concerned about is the ability of the SPE030 to correctly translate stored variable values (forget about syntax and interfacing).

Nevertheless, from your insights it might seems feasible if the right syntax is maintain and I'll play with it and see how it goes.

Thanks once more.
 

hippy

Ex-Staff (retired)
I was meaning #b0 isn't supported by I2C, rather than SPE030 doesn't support I2C :)

I believe the SPE030 can only do on-the-fly TTS via I2C so you cannot use #b0. If you simply send the variable b0 the SPE030 won't do anything unless it understands the value in b0.

Set b0=98, and send the value in b0 then it will likely say "Bee" as 98 is ASCII "B", set b0=21 and send that and it probably won't say anything as that's not an alphabetical ASCII character.

Set b0=21, expand that using BINTOASCII, into b3="0", b2="2", b1="1" and sending b2 then b1 will have it receive "2" then "1" which it will see as "21" and I expect would then speek "twenty-one". That's what westaust55 was indicating in post #5.
 

Pauldesign

Senior Member
Thanks Hippy for the vivid clarification and i'm glad u finally understand what i've been trying to explain.

When i'm a bit free and since tomorrow is universe wedding of the century (i wonder if the UKers will be active on the forum 2moro:rolleyes:), I'll give it a shot as you guys suggested and update the post. ;)
 

Pauldesign

Senior Member
Hippy and Westauss55; thanks for the heads up tip. ;)

I now have a real time speaking thermometer and more to that is a speaking alarm clock, time, date, location informer, speedometer, odometer and what have u. :)

Not to talk of the countless amount of accolades i've received from sexy mamas in the neighborhood. I'm freaking them out with PICAXE magic. :D

FYI: the hash sign (#) is translated and spoken as number and not as hash; as thought. What an impressive device!
 
Top