Go Down

Topic: Arduino MEGA Serial Communication using TX2 and RX0 (Read 8632 times) previous topic - next topic

MarkT

You have no decoupling anywhere - not difficult to see why you don't need the IR receiver to pick up any light if
its comparator catches glitches from the supply rail - decouple all chips, especially comparators (they are extremely
sensitive).   You may have to add a little capacitance on the comparator inputs to prevent false triggering too.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

xenonforlife


I'm sorry, but you don't seem to have a clue what flush() does. You haven't sent any data on Serial1. There is no reason to block until nothing has been shifted out.

I do know what flush does, however I was trying anything and everything to make it work, which by the way it still is not. Also, previously (before Arduino 1.0) flush was used to clear the buffer, so it was just a random try and nothing else.

Why? Why not an hour or two?

I had read somewhere that adding a delay provides stability to the code which deals with reading of ports. Just so you do NOT have to ask something like "Where on earth did you read such stuff...was it in your dreams??" I would like to give you a few links where the same has been mentioned:-
http://opensourcehardwarejunkies.com/tutorial-10-switch-case-statement-arduino-course-for-absolute-beginners/?utm_expid=43506286-0&utm_referrer=https%3A%2F%2Fwww.google.de%2F
http://www.fibidi.com/arduino-led-button/
If you check the comments on the delay statements on these two links, you will see what I meant.

An honest suggestion, I would appreciate it much more if you would try to help out with the problem rather than using that mocking tone. You sure may know much more than me as far as Arduino is concerned but that surely does not give you any rights to mock someone like that. The whole purpose of posting on this forum is to spread the knowledge that you already have and maybe even learn a thing or two in the process. If you do not know the answer to a question, in my honest opinion, it is a good idea not to comment on those aspects of the code which won't have any effect on the code execution at all and waste your and my time as well. Without these statments too the code in reply#7 should run fine as far as I know, I asked the question because I found some anomalies to my understanding, and not to be ridiculed that way. No offence meant.

xenonforlife


You have no decoupling anywhere - not difficult to see why you don't need the IR receiver to pick up any light if
its comparator catches glitches from the supply rail - decouple all chips, especially comparators (they are extremely
sensitive).   You may have to add a little capacitance on the comparator inputs to prevent false triggering too.

Thank you for your valuable suggestion, I will surely try it out and post my findings here again. Thanks again.

PeterH


in that case could you please look at the code I had placed in reply# 7 and tell me if what I have done is theoretically and logically correct..because I have the issue with that code too.


You'd need to make it clearer what the connections were when you ran that code, because you're describing several arrangements in that post.

The behaviour you described originally matched up with what I would expect given that code and the hardware you described, assuming the IR link worked.

xenonforlife


You'd need to make it clearer what the connections were when you ran that code, because you're describing several arrangements in that post.

The behaviour you described originally matched up with what I would expect given that code and the hardware you described, assuming the IR link worked.


The arrangement that I have corresponds to the one in the image that I have uploaded which is something like this:-
1.Tx2 is connected to the LED via an LED driver.
2. The receiver output (from the photodiode circuit via the differential amplifier to the comparator which  gives us the final 5v/0v output) is connected to Rx1.
What I am trying to do here is transmit and receive serial data via an IR link. Ideally I should not be seeing Hello World at all as I am not receiving anything at all(My LED is not pointed to my photodiode).

xenonforlife

OK..now I am really confused. I noticed something which has completely baffled me. Here is what I observed.
1. I DISCONNECTED my Arduino from the computer and did NOT give it any additional power.
2. I just wanted to check the voltage that I was getting on my receiver output with a multimeter.
Now this is what happened, when I let light fall on the photodiode, the receiver output went to 5V as expected, however the led that is connected to my Tx2 pin glows. Now how on earth is that possible??? This obviously means that the circuit is completed when I get a 5V output at Rx1. Which obviously concludes that Tx2 and Rx1 are interally shorted  :smiley-eek-blue: :smiley-eek-blue: .Am I going mad, this is bizzare. I also thought that mx board might have gone bad, However after that I have tried all possible combinations of Tx and Rx pins, same result everytime. Can someone please throw some light on this??

xenonforlife

Just so that everyone can see what I am talking about, I am attaching another image here where I had connected the LED driver with Tx1 and the comparator output to Rx3. Now I put light on one of my sensors using a cellphone flashlight and you can see the LED glowing in the picture. Can anyone give me a sane explanation for this? There is no program running on the board obviously, since it is not powered. It has to do something with the internal circuitry, does anyone here have any idea about this?

PaulS

Quote
If you check the comments on the delay statements on these two links, you will see what I meant.

That delay is in there to give the ADC time to discharge between readings. It has NOTHING to do with reading Serial data, sending Serial data, or anything NOT involving the ADC. And, even then, it's use is questionable.
The art of getting good answers lies in asking good questions.

xenonforlife


That delay is in there to give the ADC time to discharge between readings. It has NOTHING to do with reading Serial data, sending Serial data, or anything NOT involving the ADC. And, even then, it's use is questionable.

Yes I do get that, as I said I was trying anything and everything to maker this thing work. I had not put it in my code initially, anyhow I have removed it again, and yes the result is still the same as expected. You might want to take a look at my previous two replies and if possible help me with the bizzare stuff that is happening.

xenonforlife


MarkT


Just so that everyone can see what I am talking about, I am attaching another image here where I had connected the LED driver with Tx1 and the comparator output to Rx3. Now I put light on one of my sensors using a cellphone flashlight and you can see the LED glowing in the picture. Can anyone give me a sane explanation for this? There is no program running on the board obviously, since it is not powered. It has to do something with the internal circuitry, does anyone here have any idea about this?


You've created a very expensive piece of wire using the MEGA's input protection diodes, but that's not exactly useful is it?
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

xenonforlife


You've created a very expensive piece of wire using the MEGA's input protection diodes, but that's not exactly useful is it?


Haha, no that is not useful at all, however it puzzled me why this was happening at all? This was not my objective anyways, just saw this happening by chance so got curious to know how exactly I observed something like this...

Go Up