Go Down

Topic: Inserting Start bit and Stop Bit in a serial communicatiom (Read 23949 times) previous topic - next topic

GoForSmoke

Radio Shack has been selling working devices to use home power lines for communications since at least the 70's under the name X10. My brother had them.

http://www.x10.com/x10-home-automation.html

Maybe you can reverse engineer the system to use long and short pulses as your 1's and 0's. Then you need to find out how long to make those reliable.

If you do this then be sure and get your TV, computer and every appliance with a chip in it plugged into Power Conditioners because the noise you will be making may cause one or more of those to fail eventually. Other Than That it's not a bad idea.


1) http://gammon.com.au/blink  <-- tasking Arduino 1-2-3
2) http://gammon.com.au/serial <-- techniques howto
3) http://gammon.com.au/interrupts
Your sketch can sense ongoing process events in time.
Your sketch can make events to control it over time.

surajveer37

@Robin2
thank you for responding really well and kind first of all :)
So just help me out with this! Tell me in simple words what needs to be done now? I have provided my code so as its output and all the module details !
Should i be changing my module and make my finger crossed  for something to happen in my way? or you suggest any changes elsewhere?

Robin2


So just help me out with this! Tell me in simple words what needs to be done now?


I have already said that you need to get a datasheet for the device so you have the full details of how it should be used.

I assume you have a setup like this

   ArduinoA ----deviceA ----------power line---------deviceB---ArduinoB

A good idea would be to connect the two Ardunos without anything in between and make sure that you can send data between them using the same connections you will use to communicate with the devices.

If that works then I don't have anything else to offer until you produce the datasheet.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

GoForSmoke

How clean the power in the line itself should make a difference as to what kind of speed can be achieved. Back in the day I'd gotten industrial customers to buy Tripplite line conditioners to keep their equipment safe and stable. My UPS conditions my PC power which helps. Where I am the stuff out of the wall is spiky "dirty" as over and under VAC.

Laying signal on top of the power sine waves to pick it up elsewhere, the cleanest power will give the best results. If you don't get what you should out of those PLC's then check your power, you can do something about that.
1) http://gammon.com.au/blink  <-- tasking Arduino 1-2-3
2) http://gammon.com.au/serial <-- techniques howto
3) http://gammon.com.au/interrupts
Your sketch can sense ongoing process events in time.
Your sketch can make events to control it over time.

Grumpy_Mike

You could put a band pass filter on the mains input of those two devices to remove the noise. It would have to be a passive LC filter and the components rated for mains. But you need to know the modulating frequencies used for that.

Robin2


You could put a band pass filter on the mains input of those two devices to remove the noise. It would have to be a passive LC filter and the components rated for mains. But you need to know the modulating frequencies used for that.


I'm waiting for the OP to produce the datasheet for his devices. It seems to me they should already be doing this stuff.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

nickgammon


I have provided my code so as its output and all the module details !


What code? This?

Code: [Select]

void setup()
{
  Serial.begin(9600);
  Serial1.begin(9600);
  pinMode(13, OUTPUT);
}

void loop()
{
  if(Serial1.available())
  {
    char a=Serial1.read();
    if(a=='A')
    {
      digitalWrite(13, HIGH);
    }
   
    if(a=='a')
    {
      digitalWrite(13, LOW);
    }
    Serial.print(a);
   
  }

  if(Serial.available())
  {
    char a=Serial.read();
    Serial1.print(a);
  }
}


Quote

So just help me out with this! Tell me in simple words what needs to be done now?


I'm moving this to Gigs and Collaborations. There is nothing in that code about power lines.
Please post technical questions on the forum, not by personal message. Thanks!

More info: http://www.gammon.com.au/electronics

Robin2


I'm moving this to Gigs and Collaborations. There is nothing in that code about power lines.


I know it has been frustrating trying to get info from the OP but I don't understand the move here. I thought this area was for people who want someone else to write code for them.

I don't normally read the G&C section.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

GoForSmoke


You could put a band pass filter on the mains input of those two devices to remove the noise. It would have to be a passive LC filter and the components rated for mains. But you need to know the modulating frequencies used for that.


As long as you don't filter out the signal as well.
1) http://gammon.com.au/blink  <-- tasking Arduino 1-2-3
2) http://gammon.com.au/serial <-- techniques howto
3) http://gammon.com.au/interrupts
Your sketch can sense ongoing process events in time.
Your sketch can make events to control it over time.

GoForSmoke

Hey Nick, there's nothing in radio module code about noise sources but a room with sparking gaps will affect the rate at which radio communications can be achieved. I only mention line noise because he is transmitting on power lines and those are subject to noise, sometimes a lot of noise like when heavy motors are connected directly to them.
1) http://gammon.com.au/blink  <-- tasking Arduino 1-2-3
2) http://gammon.com.au/serial <-- techniques howto
3) http://gammon.com.au/interrupts
Your sketch can sense ongoing process events in time.
Your sketch can make events to control it over time.

nickgammon


I know it has been frustrating trying to get info from the OP but I don't understand the move here. I thought this area was for people who want someone else to write code for them.

I don't normally read the G&C section.


The OP said recently:

Quote

So just help me out with this! Tell me in simple words what needs to be done now? I have provided my code so as its output and all the module details !


His posted code is nothing to do with anything much. It just does a serial read and turns a pin on. It seems to me he is asking people to write the code for him, and thus it is suitable for Gigs and Collaborations.

If the OP makes a bit of an effort to answer questions, I could move it to Project Guidance.
Please post technical questions on the forum, not by personal message. Thanks!

More info: http://www.gammon.com.au/electronics

GoForSmoke

You're right Nick. That is one of the standard ploys I've seen here.
I guess I'm just not used to seeing it handled properly. Good move!
1) http://gammon.com.au/blink  <-- tasking Arduino 1-2-3
2) http://gammon.com.au/serial <-- techniques howto
3) http://gammon.com.au/interrupts
Your sketch can sense ongoing process events in time.
Your sketch can make events to control it over time.

surajveer37

tell me if something is wrong with you guys?
i asked for the help that's it
if you don't know how to help so just keep calm and don't post such words!
Thank you so much all of you.
i was looking for KQ330 data sheet these days long as @robin asked but couldn't found such.
i don't know whats wrong here with you people..

surajveer37

@robin this is the material i found about KQ330 module
Description:


KQ-330F Series performance:

1 small size thick film integrated module Overall dimensions of 33 × 19 × 13 mm (L × D × H), 11-pin single row leads feet spacing of 0.1 inches.

Operating frequency 120 ~ 135KHZ, interface baud rate of 9600bps. Actual baud rate 100bps on 250 byte buffer.

Temperature range: -25 C ~ +70 C Humidity ? 95%

4 Power supply: Imax ? 20mA DC +5 V received  ? 12mA

5. Few and inexpensive external components to be connected directly to 220V AC carrier communication.


Specifications and models:

KQ-330F:

330 after the first letter is defined as:

F: zero crossing transmission type

Other performance See KQ-130F, KQ-130F +

1P-IRX, carrier signal input

2P-AGND, analog signal common-locations

3P-VAD, a 470uF capacitor  parallel between the analog circuit power and AGND

4P-VCC, +5 V

The 5P-DGND, digital circuit co-location

6P-RX, the modulation data input, then the microcontroller TXD

7P-GL, zero-crossing detection input, then the optocoupler collector

8P-T1 carrier frequency output

9P-TX, the demodulated data output terminal, connected to the microcontroller RXD

10P-MODE, carrier data mode control

11P-NC

KQ-330F circuits for CMOS type, user Do not plug or unplug when in use, should be anti-static, to avoid damage to the internal chip. Welding should use anti-static electric iron.

AGND and DGND by the user in the external wiring connected at one point T1 provides maximum 20mA load drive capability.

 


Robin2

#44
Sep 27, 2014, 08:05 pm Last Edit: Sep 27, 2014, 08:12 pm by Robin2 Reason: 1
I would much prefer if you post links to documents rather than transcribe them - with a risk of errors.

You have not said whether the diagram I included in my earlier post is correct?

The kq330 seems to be part of the device in the link you posted in Reply #28. Are you using the board in Reply #28 or are you using the "bare" kq330?

What is the purpose of the additional components on the board?

The problem I have is that you have not produced a document that explains how to use it. In the absence of such a document I can only assume that it works with simple serial reads and writes. But remember, if it only conveys data from one device to the other at 100bps there will be a considerable delay between sending and receiving compared to transmission at even 9600baud.

One problem with not having a datasheet is that we don't know how to detect whether a byte has been received, or whether you need to wait a bit longer.

Maybe the answer is to buy a device for which you can get a datasheet.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

Go Up