View previous topic :: View next topic |
Author |
Message |
hgrueneis
Joined: 04 Apr 2009 Posts: 902 Location: A-4786 Brunnenthal
|
Posted: Mon Jul 25, 2016 6:55 pm Post subject: TWI at extremely low clock frequency |
|
|
Hello,
has anybody tried TWI with a very low frequency?
If the crystal frequency is divided down to like 125000Hz, then TWI configuration (Master) lets me put 250Hz.
This would be useable for long range transmission with slow data rate.
Line capacitance would not matter that much at such a low frequency.
Maybe with pull up resistors that cause about 10 to 20 mA, depending on MCU type.
Advantage would be...no line drivers.
The same principle works for extremely slow RF baud rates.
Please let me know if you did anything like this.
Thanks
Hubert
(BASCOM-AVR version : 2.0.7.8 ) |
|
Back to top |
|
|
MWS
Joined: 22 Aug 2009 Posts: 2262
|
Posted: Tue Jul 26, 2016 12:40 am Post subject: |
|
|
No own experience, but even with the lowest clock, you need to stay in specs with rise- and fall-time of the signals, which depend on line capacity, thus length of the wires, together with the pullups. Pullup resistance can't be too low, as it depends not only on the MCU's driver capabilities, but also on how much current the slaves can pull down. |
|
Back to top |
|
|
hgrueneis
Joined: 04 Apr 2009 Posts: 902 Location: A-4786 Brunnenthal
|
Posted: Tue Jul 26, 2016 2:28 am Post subject: |
|
|
@MWS,
you are right, should have looked at the electrical characteristics rise and fall times.
Looks like there is no way around the line drivers unless I do my own soup.
Thanks for your input.
Hubert |
|
Back to top |
|
|
AdrianJ
Joined: 16 Jan 2006 Posts: 2483 Location: Queensland
|
Posted: Tue Jul 26, 2016 5:30 am Post subject: |
|
|
Another possibility with very good clock speed variation and noise immunity, as well as signal polarity independence, is bi-phase encoding, a variation of Manchester encoding. Things like infra-red remotes use it, but the encoding works well over wires too. Never tried it over long distances, but it should work, if you can tailor the transmit and receive systems to cope with whatever conditions you want. Of course, its not supported by any hardware, but its pretty easy to find or modify software to do the job, especially at low speeds. If you are still wanting this with networking capability, you will have to develop your own addressing protocol. _________________ Adrian Jansen
Computer language is a framework for creativity |
|
Back to top |
|
|
hgrueneis
Joined: 04 Apr 2009 Posts: 902 Location: A-4786 Brunnenthal
|
Posted: Tue Jul 26, 2016 9:52 am Post subject: |
|
|
@Adrian,
looks good but it still needs a sync line or signal to be synchronized.
For the purpose I need it, simple Morse code might just be OK.
Already designed the board with bidirectional drivers for TWI.
For temperature and alarm control, time really does not matter that much.
I just did not want to do RF (maybe I know too much about it...not secure, even with encryption).
I may be a bit old fashioned and not control the house with the smart phone.
Thanks to all.
It made me think a bit more about it.
Hubert |
|
Back to top |
|
|
six1
Joined: 27 Feb 2009 Posts: 553
|
Posted: Tue Jul 26, 2016 10:32 am Post subject: |
|
|
Hubert, have a look at "fhem". It is amazing! I build up a house automation with this, including weather, sound, light, cam and more.
My wife likes it you don't have to switch the light on and off you will be wake up with music and i can have a look on it, if i stay away.
I does it with Homematic parts with back channel (response on action).
It is secure in the case, you will think "a little bit" about it.
as an officer i will say:
But what is "secure"... if someone want's to get in the house, he will... i'm sure
best, michael _________________ For technical reasons, the signature is on the back of this message. |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Tue Jul 26, 2016 10:49 am Post subject: |
|
|
openhab is great too, but it is way off topic. _________________ Mark |
|
Back to top |
|
|
hgrueneis
Joined: 04 Apr 2009 Posts: 902 Location: A-4786 Brunnenthal
|
Posted: Tue Jul 26, 2016 5:07 pm Post subject: |
|
|
Both systems have a lot to offer.
Looks like I have a lot to read and learn.
Thanks for letting me know about these systems.
Hubert |
|
Back to top |
|
|
AdrianJ
Joined: 16 Jan 2006 Posts: 2483 Location: Queensland
|
Posted: Tue Jul 26, 2016 11:25 pm Post subject: |
|
|
Bi-phase encoding can be done without a separate clock or sync line. IR links definitely work without them !
You send two pulses at the start of a message, and the relative pulse widths of those are used to define the bit clock rate, and the start of each message. Each message can have its own clock rate, and as long as the rate within that message does not drift more than about 50%, the message bits can be recovered. Its a neat system !
But I agree that there are already plenty of protocols for home automation, as mentioned by others, and they probably solve all those problems to, in other ways. _________________ Adrian Jansen
Computer language is a framework for creativity |
|
Back to top |
|
|
hgrueneis
Joined: 04 Apr 2009 Posts: 902 Location: A-4786 Brunnenthal
|
Posted: Wed Jul 27, 2016 2:32 pm Post subject: |
|
|
Thanks Adrian,
changed the board design so that I can implement multiple things if needed.
One possibility, similar to what MWS suggested in the previous I2C/TWI post.
Since I only need to transfer a few bytes (4-8) at a time from each station, I am thinking of following system.
Have one line go to for example the T1 input of all slaves and trigger an interrupt (pin change) on them. Disable interrupt on slaves and send slow counter pulses from Master
according to their address. The slaves listen for a predetermined time and then read the counter.
The slave with the corresponding count after that time changes the line to output and sends it's data to the master. All that is needed, is one line and ground or add one
extra line just for transmission of the data (2 lines and ground). A retransmit to the slave for comparison with ACK could be added or checksum.
After the transmission time (predetermined) all slaves enable interrupts again. Done.
Depending on Speed and cable capacitance and pull up/pull down capability (AT168 slaves, AT1284 master) it should work for quite a great distance on only a 5 Volt supply.
Maybe I could use the Bascom commands for serial in/out or shift on low speed.
But I will also again look into I2C with drivers and Bi-phase.
Home control the total way is not quite my thing because I want the systems separated (with battery backup) like keyless entry, alarm, lighting, solar water and electric, TV and Audio, Backup power and Heating/AC. That way, if one system fails, I can still get into the HOUSE through the other door.
Thanks again, you all have supplied great suggestions.
Hubert |
|
Back to top |
|
|
AdrianJ
Joined: 16 Jan 2006 Posts: 2483 Location: Queensland
|
Posted: Wed Jul 27, 2016 11:11 pm Post subject: |
|
|
I must admit I dont see why you are trying to avoid drivers.
The chips for RS232 or 485 are cheap, and they are designed to be reliable and noise immune, especially if you use things like RS485. Half duplex will work perfectly for what you are tring to do. That means only 3 wires, including ground. Just assign one master, send an address and data ( or data request ) to each slave, wait for the response, then send again for the next slave. Its nothing to handle 20 or more slaves under that system. Many serial protocols for that type of network. I use SNAP, but there are plenty of others.
I rather keep anything hanging on a long line away from direct connection to a micro, they are too sensitive to stray EMC pulses, and fail catastrophically. _________________ Adrian Jansen
Computer language is a framework for creativity |
|
Back to top |
|
|
hgrueneis
Joined: 04 Apr 2009 Posts: 902 Location: A-4786 Brunnenthal
|
Posted: Thu Jul 28, 2016 1:05 am Post subject: |
|
|
@Adrian,
I don't try to stay away from line drivers, even designed the boards to include them but added other possibilities.
Just want to find out the best solution to the task. I don't care so much about investing a bit more.
Just want to make it as foolproof as possible, so when I possibly reach 80, I am not challenged with stuff I already forgot meanwhile...ha..ha, actually not so funny.
According to the life of the flash memory it will most likely outlive me by two or three generations.
By the way, just ordered a bunch of P82B96TD.112 I2C drivers this morning (use was suggested on previous post).
I just want to try it all and see if anybody had any positive or negative experience with any of that or related.
I also think that it might help some people on this forum to talk about it.
Bascom makes it possible with relatively little effort.
Thank you for your input, I appreciate it very much.
Hubert |
|
Back to top |
|
|
Paulvk
Joined: 28 Jul 2006 Posts: 1257 Location: SYDNEY
|
Posted: Thu Jul 28, 2016 3:24 am Post subject: |
|
|
Hello Hubert
I am building similar things with a lot of 1wire and I2C devices to monitor my off grid solar systems
and the rest of the houses (2 systems)
I came across this bus extender P82B715 the idea of star topology was interesting
as running to a point (a heap of batteries 44) then fanning out was in my thoughts.
Regards Paul |
|
Back to top |
|
|
AdrianJ
Joined: 16 Jan 2006 Posts: 2483 Location: Queensland
|
Posted: Thu Jul 28, 2016 5:21 am Post subject: |
|
|
@Hubert
I tend to regard I2C as short range stuff. The very fact that the pullup impedance is around 5K or so, and unbalanced, means you will get very poor noise immunity. Maybe the long line drivers are better. But IMHO RS485 is by far a better solution for random networks. Low impedance, balanced lines, good common mode rejection, good ESD protection. What else can you want ?
When you see literally miles of cable run around places like oil refineries, all running RS485, and mixed up with high current power lines, and big contactors driving valves and pumps etc, you realise how good that stuff actually is. It might seem like overkill in a house, but its something which you can install and forget ( until the rats chew through the cable ).
You might bear in mind that Ethernet and USB also use essentially the same drivers and system, just different protocols on top of it. Yes, of course Ethernet is also DC isolated as well, but that is only a refinement.
Have fun. _________________ Adrian Jansen
Computer language is a framework for creativity |
|
Back to top |
|
|
hgrueneis
Joined: 04 Apr 2009 Posts: 902 Location: A-4786 Brunnenthal
|
Posted: Thu Jul 28, 2016 7:40 am Post subject: |
|
|
Adrian,
you have a very strong argument against I2C for long range.
Years ago when I was experimenting with it, I noticed that line length and pull up resistance where very restrictive
to tolerance and error prone. On the same board or close by it is not a problem.
To prove my point here... it is really important to listen to other peoples minds and knowledge in order to make
up your own mind and do the best you can.
Thank you Adrian and I hope, when I am disabled and frail that the rats will not get the cables or me...provided.. there will be rats... or me .. or... .
RS485 is certainly a good way and I will consider it. Me and my wife (not be mentioned last) are known to do version 20.20 before really
committing to a final thing (design and redesign). Atmel (or who ever owns it now) and Bascom will make it reality.
Thanks again.
Hubert |
|
Back to top |
|
|
|