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.

Cheers,

Steve.;)


ARC Pro

Upgrade to ARC Pro

Take control of your robot's destiny by subscribing to Synthiam ARC Pro, and watch it evolve into a versatile and responsive machine.

#1  

You will need voltage regs for most sensors if powering the EZB4 above 5v... Most sensors are 3v or 5v... If they are compatible with the arduino then most likely they will be compatible with the EZB4... The sensors you have listed here will need to use a serial interface most likely (If you have their data sheets we can confirm)... In this case you can use one of the 3 UART ports on the ezb4 to read them...

United Kingdom
#2  

The DHT11 is a serial device so must be connected to a UART port. It's quite complicated to get the data out of too. I use one on an Arduino as there is a library written for it for Arduino, I'm yet to find the time to attempt to port it over to ARC.

There isn't much info on the smoke sensor, I'll need to see if I can find a decent datasheet or arduino library for that before I could comment on it's suitability.

United Kingdom
#3  

Thanks for the replies guys.

So it doesn't sound as easy as I first thought it might be. The only info I have on these sensors is what is on the sales pages, no data sheets.

The links I supplied were only examples of what I was thinking of getting, but if there is something else out there that would be v4 compatible that anyone knows of, I'd love to know.

Steve. :)

PRO
Synthiam
#4  

I just spoke with Jeremie today and we will have the 5 volt regulator ez-bit in the store within 2-3 weeks

United Kingdom
#5  

That's great to hear DJ. So could you tell me, with the 5v regulator EZ bit, would using the sensors I mentioned be easy to use with the v4? If so, how would I go about scripting or coding these sensors to work the way I would like with a verbal response?

Steve.

#6  

Short of coding it for you, it's all in ARC including examples... below are some of the commands you would need to use.... I used these successfully to communicate with a Roomba...

Just give it a shot yourself... If you get really stuck you can ask here....

UartInit UartAvailable Uartread Uartwrite

Getbyte GetByteAt

United Kingdom
#7  

Thanks Richard. I'll have a look at the examples and see what I can make of it. So you reckon these sensors will work with the v4 then? I know you said about the temp sensor may work with the v4 as it's compatible with arduino, but there was no mention on what the smoke/gas detector sensor would work with.

#8  

The gas sensor (methane, natural gas etc) may be analog.... Again, you may have to find a data sheet to confirm this... As I said, if it works with an arduino, chances are it will work with the v4... I do realize a lot of these Chinese sensors come without info on how to use the... which is of course frustrating...

Sorry I can't be more help than that....

United Kingdom
#10  

Quote:

0~5V analog output voltage, the higher the concentration the higher the voltage

The gas sensor would work on the ADC port, the same way any analogue sensor works on an ADC port. I'll post an example when I have more time (need to leave in 2 minutes).

The Temp sensor would need to use the UART functions, the result would need to be parsed. The result is both temperature and humidity at the same time. I plan to look at porting this over to ARC soon, until then you could check the arduino library and see if you can figure it out.

United Kingdom
#11  

Any news on the 5v regulators will be available in the store?

#12  

Yep. I am using the smoke detector in the opening thread. Using like @ruch said. The analog voltage reader. One thing thoug . The smoke kinda has to be blow in its direction for it to really work. And it gets kinda hot depending in the sensitivity you set on it.

I added one to the chest of my wall-e ...he sits on my desk...and when I smoke he comments.

United Kingdom
#13  

Thanks for your reply hoolagen1. Great to hear somebody else is using one too. Just to be clear, do I still need a regulator to use the 5v smoke detector sensor through an analog port when powering the EZ-B with a 7.4v battery? Also, would you be willing to share any code/script you are using to help get me started? I really wouldn't know where to start. confused

Thanks.

#14  

You don't need a regulator for the analog ports... The power pin on the analog ports is 3.3v... It's the digital ports you need to use the reg because the power pin is = to battery voltage...

United Kingdom
#15  

That's made things clearer. Thanks Richard. :)

#16  

@SteveG be aware you may have the opposite problem.... The analog ports on the EZB4 output only 3.3v... while this should be enough, some sensors need a full 5v to function properly.... Maybe @hoolagen1 can let us know which ezb he is using as the ezb3 analog ports are 5V not 3.3v...

#17  

using ezb3 direct plug into the board. 5v to all plugs

United Kingdom
#18  

Hi guys.

I'm bumping this thread as I have purchased and received the two sensors I mentioned, and would like to ask for some assistance as I need additional help to get started installing them.

Rich mentioned that the smoke detection sensor would work using the analog (ADC) ports. But is there a specific way I need to wire it up to the pins on the ADC port? GND goes to ground, Vcc goes to Red, but not sure about the other two wires. Smoke sensor picture below.

User-inserted image

As for the temperature sensor, Rich also mentioned that this would work through the UART port. Again, how should I wire this up? Temp sensor picture below.

User-inserted image

I so far have not used the ADC or UART ports on my EZ-B yet, so any advice to help me wire these up correctly would be appreciated.

Many thanks.:)

#19  

Steve G, it looks like the smoke sensor has an Analog output pin and also a Digital output pin so it can be wired to either type port.

The temp sensor does not have a UART output. There are pwr (+) and (-) and a signal lead. Uses an analog port.

#20  

DOUT= digital out AOUT= Analog out VCC = voltage in (don't use more than 5V to test it) GRD= is self explanatory

Plug it in to an analog (AOUT) port, bring up the ADC control and see what happens to the value as you blow smoke over it...

If it is a digital sensor, I am afraid I would need the sensor and the data sheet in order to get it working for you... Receiving data with the ezb is not that straight forward as sending it.... So lets hope it works using the analog port...

United Kingdom
#21  

Thanks @Robot-Doc.

Smoke sensor. Just got it. "Aout" is analog and "Dout" is digital. So using only one of these wires, this would go to either the ADC or digital signal pin?

And on the temp sensor, the "s" is signal? Sounds obvious but I just want to be sure before I fry anything as they didn't come with any paperwork.

#22  

Use.. ADC on an analog pin... If you use digital you'll have to figure out how to receive an unknown data format (since we don't have data sheet for it) over one of the UART ports.

@Doc... the digital output my guess would be TTL?

United Kingdom
#23  

@Richard.

Just writing a reply to Doc when you replied. Thanks for the info. I did get 5v regulators but obviously won't need to use them if using the analog ports. I'll give it a try tomorrow if I get a chance and let you know what happens, if anything.

#24  

Analog port power pin is 3.3V... The temp sensor might need 5V, however... S = white pin, - to black pin and + to the red pin.... If it works it will only give an analog value that probably won't have any meaning as far as temperature is concerned... If you lucky the value will increase or decrease according to the temperature... Not sure how you would convert that value to represent C or F....

#25  

@Richard R, possibly the Digital out is TTL should be easy to monitor using the EZB terminal.

United Kingdom
#26  

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.

Steve.:)

#27  

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
#28  

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
#29  

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.

#30  

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.

Alan

#31  

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
#32  

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
#33  

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
#34  

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

#35  

@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")
endif

United Kingdom
#36  

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.


$smokedetect=getADC(0)

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

Thanks again.:)

United Kingdom
#37  

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
#38  

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
#39  

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

#40  

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
#41  

@Richard.

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. :(

#42  

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....

#43  

.... Well, you might be SOL unless DJ and maybe Rich can help you then with this....

United Kingdom
#44  

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.