Welcome to Synthiam!

The easiest way to program the most powerful robots. Use technologies by leading industry experts. ARC is a free-to-use robot programming software that makes servo automation, computer vision, autonomous navigation, and artificial intelligence easy.

Get Started
United Kingdom
Asked — Edited
Resolved Resolved by Dunning-Kruger!

Temperature And Smoke Detection Senors With Ez-B V4

User-inserted image

Hi guys.

I need a little advice on some additional sensors I was thinking of adding to my bot, and as I am still waiting for my dev kit and extras to arrive, I am unable to test what I am thinking of doing so I'm hoping someone can point me in the right direction.

I had an idea of adding a smoke detection sensor and maybe a temperature sensor as well. The idea being that if I ask the bot what the current temperature is, or if the bot detects smoke or Co2 fumes, the bot would respond with verbally with a pre-recorded MP3 file of the Cepstral voice I have, or one better, have my bot tell me what room the smoke or gas is detected in. Here are a couple of links to what I am thinking of adding.

Smoke detection sensor

Temperature sensor

Would these sensors be compatible with the EZ-B v4 and 7.4 LiPo battery? I see that the temperature sensor is compatible with Arduino so I am hoping that both of these sensors will play nice with the v4. Also, has anyone tried something similar to what I am thinking of doing? As always, any help or advice anyone can offer would be greatly appreciated.




Upgrade to ARC Pro

Become a Synthiam ARC Pro subscriber to unleash the power of easy and powerful robot programming

@Richard R, possibly the Digital out is TTL should be easy to monitor using the EZB terminal.
United Kingdom
Well after going to the end of the Internet and back, I found data sheets for both sensors.

The first one is for the smoke sensor which had a sample of Arduino code (Richard, I know your familiar with Arduino), and the data sheet below.

Smoke sensor Data sheet.

And I fouund a data sheet for a temp sensor which looks a little different to what I have, but has the same specs. Also my temp sensor works from 3.3v to 5v so I should be golden there.

Temp sensor Data sheet.

The smoke sensor is an easy one... It's analog... Connect it to an analog port and read the values in the ADC control as smoke hits it... The value will either increase or decrease depending on the concentration of smoke... From here you can determine at what point that you want the sensor to alert you of smoke... However, remember the Analog ports on the ezb only put out 3.3V so if the sensor requires 5v it may not work unless you can get external 5v power for it.

The temp and humidity sensor is another story.... It will take someone who knows a lot about the EZB4 UART... I managed to receive 8bit data from a Roomba but that's it so far... The temp and humidity sensor (from the data sheet) requires I think 40bit.... DJ and possibly Rich are probably the only 2 who can help you here.... sorry
United Kingdom
Hey, no problem Richard. Thanks for looking in to it and getting back to me. It's much appreciated :). So in regards to the temp sensor, it won't work via analog? Rich did mention it could be UART.

And with the smoke sensor, would there be a lot of difference if I used a digital port? I ask because if I find that voltage is an issue via analog, I do have 5v regulators I can use with the "Dout" pin. Just not sure what to do with the scripting side of things.
United Kingdom
It is uart. Im away at the moment and no idea when im back home but its on the top of the list of things to port from arduino to ez-b.
For the smoke detector, the data sheet is not for the board, just for the sensor, so it doesn't tell us what is coming out the digital port. Digital is likely to be UART as well unless it is very simple like the Ping Sonar, but that would surprise me. It will be much easier to use as an analog sensor where the behavior is well understood. ie, you plug it in and read the value. The initial value either goes up or down in the presence of smoke.

The smoke detector does work with analog.... I just tested one with an Arduino.... As I said, if you're going to go digital you'll have to mess with the UART and data receive.... Again as mentioned, I have only been able to receive 8bit data from the UART port (255 max values)... I have been trying to get 2byte data (High byte, low byte) from my iRobot Create for sometime now... no luck....

It has been mentioned here (by a member who is/was trying to read feedback data from his dynamixel servos) that there may be issues still with the UART receive...
United Kingdom
Thanks guys, and happy new year to you all.:)

Haven't had a chance to try anything out yet, but will do tomorrow. I had a thought in regards to both sensors and their 5v power requirements. Could I run the ground and Vcc from a digital port through a 5v regulator, and the signal wire from an ADC signal pin to keep the sensors running on analog, or would that not work?
United Kingdom
That would work if you can lose the digital ports power. You could make a quick protoboard strip for 5v and gnd which comes off of a digital port too...

Digital port to regulator to protoboard strip of pin headers... as long as the demand doesnt exceed 1a it'll be ok.
United Kingdom
I must admit you lost me a little there Rich, sorry. What do you mean by "losing digital ports power"? I take it a straight digital ground and Vcc connection to regulator, to sensor, is not advisable? What would the protoboard be needed for exactly?

Success with the smoke sensor. After reading that Richard had one working with Arduino I plugged my one in to an ADC port, used the "Read ADC" control, blew some smoke at it and the values changed very well. It is now installed in to K-9's face plate.

User-inserted image

User-inserted image

Now I need to learn (quickly) how to scrip this so I can have say that smoke is detected using SayEZB(). I say quickly as I don't want to smoke out the house trying it out. :P
@Steve... Use the GetADC(adc0)) to read an analog value of your smoke detector...
something like this in a script (it will obviously have to be put in a loop or use whatforchange statement)


$smoke=getADC(adc0) #read the value on A0 port
if($smoke>100) #or whatever value represents the presence of smoke
sayEZB("Warning, smoke detected")
United Kingdom
Many thanks Richard. I did write a script similar to yours this evening but couldn't get it to work as I made a mistake on line 1.



Now I see what my mistake was, using the wrong syntax which should have been getADC(adc0) .

Thanks again.:)
United Kingdom
Sorry, was replying from my phone so was a lot more brief than usual.

By taking the Vcc and Ground from one of the digital ports you will not be able to use those pins for something else, i.e. you lose those 2 pins. Not a problem if you are using a H-Bridge or Ping sensor as only the signal pin is required for at least one port on both of those items.

The protoboard, pretty much is this...
User-inserted image

Red & black wires on the bottom just indicate soldering and if it's Vcc (red) or Ground (black)

One EZ-B Digital port feeds the regulator. The regulator then feeds one strip on the protoboard with +5V regulated and Ground. 5V sensors etc, can then plug in to pin headers soldered to the protoboard (at least the power can).
United Kingdom
No problem. Thanks for clearing that up Rich. It does so happen I do have some spare ground and Vcc pins left over from my ping sensor and H-bridge too, so no problems there.

Ps. Hope you had a nice holiday dude.:)
United Kingdom
Okay. The smoke detection sensor is working well so putting this one to bed. Thanks everyone for your help with this. Thanks to this, I am starting to understand EZ Script a little better now :).

Now I would like to get the temp sensor working if I can. It,s not that importand, but as I have it I would like to use it, and get a better understanding of how UART works. I have plugged it in to D6 as I believe this is one of the three UART ports. I have the ground and vcc going through the 5v regulator, and the signal wire going to the D6 signal pin as, if i got this right, this is the RX (receive) pin. I wrote a quick UARTinit() script but that's as far as I can get. So three questions...

1. Should I be using the D6 RX signal pin, or D5 TX signal pin?

2. What URAT port number is the D6 port?

3. I tried to write a UARTRead() script but it comes up with an unknown command error, and I also noticed that the intellisense only has two choices, UARTInit(boardindex, port, baud) and UARTWrite(boardindex, port, data). Any ideas to why I cannot use the UARTRead? *confused* *confused*
Good luck with the UART.... I still haven't been able to get to work with receiving data greater than 8bit... You going to need to use the GetByte and GetByteAt commands as well... There is a UART example in ARC, why don't you start with that first...
United Kingdom

I just tried the peripheral example. No joy. I tried every configuration, port 0, port 1, port 2, and used RX and TX. The byte rate never changed. :(
Another option...which I have not tried so I have no idea if it will even work... Is to use the EZB4 Serial terminal control and the GetControlValue( ) command to see if you can read the sensor data sent from the temp sensor... Again, no idea if this will work and I am not even sure if the sensor itself needs a send command instruction from the ezb in order for it to spit back data...

or... get an arduino example code for the temp sensor and port it to ezb scripting....
.... Well, you might be SOL unless DJ and maybe Rich can help you then with this....
United Kingdom
It does sound like I have bitten off a little more than I can chew right now using UART. I will see if I can find an Arduino example and port it, but I don't think my scripting skills are up to the task just yet.