Serial Levels


6 posts
by cosmicboy » Mon Dec 24, 2012 7:46 am
Hello,
I have been building an IR reader to read the SML IR pulses of my electric-meter "ehm".
I have soldered the transistors and resistors as depicted on this image:
Image

With the Arduino I am able to read the data by using one of the digital pins with the software-serial lib.
With the RPi I do not get any signal, when trying to read the data from RX Pin.

I am using 5V as VCC.
Could this be due to the fact that the RPi uses 3.3V on the GPIO Pins and the arduino 5V? I have tried to let the arduino output some "hello word" via serial and read it on the RPi's RX pin without any problem....

Any hint is highly welcome.

Thanks
Posts: 8
Joined: Mon Sep 03, 2012 9:25 am
by gordon@drogon.net » Mon Dec 24, 2012 7:53 am
cosmicboy wrote:Hello,
I have been building an IR reader to read the SML IR pulses of my electric-meter "ehm".
I have soldered the transistors and resistors as depicted on this image:
Image

With the Arduino I am able to read the data by using one of the digital pins with the software-serial lib.
With the RPi I do not get any signal, when trying to read the data from RX Pin.

I am using 5V as VCC.
Could this be due to the fact that the RPi uses 3.3V on the GPIO Pins and the arduino 5V? I have tried to let the arduino output some "hello word" via serial and read it on the RPi's RX pin without any problem....

Any hint is highly welcome.

Thanks


Yes, the Pi uses 3.3v so there is a good chance you've destroyed the GPIO pin you're connected to (along with others, but you might be lucky).

So disconnect it and re-connect Vcc to the 3.3v line and try again and if it's still not working, then I'd start to do some simple tests to test the GPIO pins on your Pi. You can use the gpio program if you have wiringPi loaded - e.g. with nothing connected to gpio 0 (BCM_GPIO_17):

gpio mode 0 in
gpio mode 0 up
gpio read 0

this should read '1'

gpio mode 0 down
gpio read 0

should read '0'

and so on. (This is using the internal pull up/down resistors to bias the input pin and is good enough for a quick test in input functionality)

-Gordon
--
Gordons projects: https://projects.drogon.net/
User avatar
Posts: 1421
Joined: Tue Feb 07, 2012 2:14 pm
Location: Devon, UK
by cosmicboy » Mon Dec 24, 2012 9:23 pm
Hello Gordon,

could you please describe, how I get the gpio programm to work?
sudo apt-get install gpio does not work, the same is true for sudo apt-get install wiringPi

Thanks
Marcel
Posts: 8
Joined: Mon Sep 03, 2012 9:25 am
by gordon@drogon.net » Mon Dec 24, 2012 9:32 pm
cosmicboy wrote:Hello Gordon,

could you please describe, how I get the gpio programm to work?
sudo apt-get install gpio does not work, the same is true for sudo apt-get install wiringPi

Thanks
Marcel


It's not currently packaged. Do this:

cd
git clone git://git.drogon.net/wiringPi
cd wiringPi
./build

and you should be set.

full details, etc. here: https://projects.drogon.net/raspberry-pi/wiringpi/

-Gordon
--
Gordons projects: https://projects.drogon.net/
User avatar
Posts: 1421
Joined: Tue Feb 07, 2012 2:14 pm
Location: Devon, UK
by cosmicboy » Tue Dec 25, 2012 8:13 am
Thanks Gordon, it works.
When doing the above cited gpio tests, I find that the pins seems to be functional.
BTW is the RX pin 10 or 15?

Thanks
Marcel
Posts: 8
Joined: Mon Sep 03, 2012 9:25 am
by gordon@drogon.net » Tue Dec 25, 2012 10:36 am
cosmicboy wrote:Thanks Gordon, it works.
When doing the above cited gpio tests, I find that the pins seems to be functional.
BTW is the RX pin 10 or 15?

Thanks
Marcel


The UART Rx pin is:

Pin 10 on the physical P1 connector.
Pin 16 in native wiringPi notation
BCM_GPIO_15.

However it looks like you need to "bit bang" the pin - ie. poll it to count pulses coming from the meter, not read (rs232) serial data, so you can connect your circuit to any of the usable pins on the connector. (I'd probably not use the serial port for this sort of application though)

-Gordon
--
Gordons projects: https://projects.drogon.net/
User avatar
Posts: 1421
Joined: Tue Feb 07, 2012 2:14 pm
Location: Devon, UK