Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

simple!!stupid!!! doubt!!!

Status
Not open for further replies.
Is it always required to connect two devices using interfaces such as spi or uart?? what i mean is if we hav to connect the output of a sensor to a comparator,cant we just cnnct the output pin of the sensor to the input pin of comparator with a wire???
 
In some cases...Yes. In some cases...No. It depends on the output specifications of the sensor!

Ken
 
Is it always required to connect two devices using interfaces such as spi or uart?? what i mean is if we hav to connect the output of a sensor to a comparator,cant we just cnnct the output pin of the sensor to the input pin of comparator with a wire???

It depends on the sensor. Some use SPI, some use I2C, some use UART, some are parallel, some are RS-485, some are CAN, while some are just logic 0 or 1. Others are an analog voltage.

For analog voltages, you can use an ADC to measure the voltage it's at, but if you only care about a threshold you need to use a comparator. You can't just connect it to a digital pin for two reasons:

-The analog output voltage might be higher than what the digital input can handle and fry it
-You don't know what the threshold is for the digital pin. It's not made to be accurate. It could be 2.5V, or it could be 2.8V. It could be 3V, or it could be 5V. You don't know. You need to use a comparator and a reference voltage so you do know what voltage it will trigger at. Also, digital inputs have a can have large hysteresis for noise immunity, so the trigger threshold when going from HI to LO might be very different when going from LO to HI! THis also makes the problem that there is a gray area where there is no defined logic state for, which is a problem because your analog sensor voltage can be in between these two voltages due to both the actual voltage output, and the fact that the analog voltage is slower moving than the digital input.
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top