Pages: [1] 2   Go Down
Author Topic: Master Slave Project  (Read 4559 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Full Member
***
Karma: 0
Posts: 235
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi all... Hope you all are fine... Its been nearly a year since I got back to Arduino and to its forum... smiley-grin Happy to be back...  smiley

I am free for around a months time from now. So thought of coming to Arduino to do a project. smiley
I really need some guidance before I start this one because I dont want it to end like the project I did last time wherein after almost completing the projects I found design flaws in it and stuff that could have been implemented or done in a much simpler way... So No mistakes this time... Gotta do it right the first the first time... smiley
Here is wat I have in mind...
Master slave config basically like a scheduler or something similar.
For that I think I guess I would be needing RTC clock DS1307, and LCD 16by2 display, and communication between arduinos
So following are qns.. ( Plz do understand I havent been checking on about Arduino or around an yr so If there are new libraries to do the foll or so plz do let me know smiley )
1. LCDs: Going to use 16by2 displays. Is LiquidCrystal still the best Library around??

2. LCD menus: Any easy way to implement this on 16by2 display? (I tried hard coding but used up some 20KB of my prev proj smiley-sad ) like functions or new libraries? I know about luidr's phi menu. But is there tutorial or so showing how to get it to work. (I am planning on using 4 buttons for my menus). Or is there anything better? need to do this menu thing right this time wasted lots of time working on it to get it right last time. smiley-sad

3. Communication. Thinking of using i2c. but I know abt its disadvantage of distance. Master and slave would be in different rooms so distance is a problem. I know about i2c bus Extenders but havent tried it with those (Anyone here has used them??) . So any other mode of communication for my project Or should I stick with i2c. I only know about i2c commuication in Arduinos. smiley-sad

Please do help me out on this one... Hoping for a fast reply...
Thanking you in Advance... smiley
 
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 227
Posts: 14051
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
If there are new libraries to do the foll or so plz do let me know
a human year equals an arduino century so smiley-wink 

OK maybe less but there is a lot of new stuff especially IDE 1.0

I2C master slave:
Seen - http://www.arduino.cc/en/Tutorial/MasterReader -  this one ?

Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

0
Offline Offline
Full Member
***
Karma: 0
Posts: 235
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
If there are new libraries to do the foll or so plz do let me know
a human year equals an arduino century so smiley-wink  

OK maybe less but there is a lot of new stuff especially IDE 1.0

I2C master slave:
Seen - http://www.arduino.cc/en/Tutorial/MasterReader -  this one ?

It been ages I know... smiley-wink Yup I have used that Master Slave thing in other projects...  smiley Any help regarding its distance or other topics I mentioned??
« Last Edit: February 29, 2012, 09:08:02 pm by 000 » Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 227
Posts: 14051
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
2. LCD menus: Any easy way to implement this on 16by2 display? (I tried hard coding but used up some 20KB of my prev proj smiley-sad ) like functions or new libraries? I know about luidr's phi menu. But is there tutorial or so showing how to get it to work. (I am planning on using 4 buttons for my menus). Or is there anything better? need to do this menu thing right this time wasted lots of time working on it to get it right last time

You can PM liudr directly, he is still a frequent visitor of the forum...
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

0
Offline Offline
Full Member
***
Karma: 0
Posts: 235
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

PMed him..  smiley Regarding i2c anyone??  smiley-sad
Logged

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 76
Posts: 7307
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey welcome back! PM received. The phi-menu has been rewritten and expanded to the phi_prompt smiley Please find the most recent phi_prompt library here:

http://code.google.com/p/phi-prompt-user-interface-library/

Get the 1.0 pre-release and the doc of the previous edition. I am still working on the new doc. The library comes with plenty of sample codes to get you started.

Only concern about your plan I have is that if you use i2c master slave, then the slave end can't read its RTC since the RTC is on i2c and a slave can read at will. Have you thought about that or do you only need RTC on master, which is fine?

For hardware, take a look here:
http://liudr.wordpress.com/shields/phi-2-shield/

RTC, and 16*2 or 20*4 display. The RJ45 Porto should take care of connecting things up at long distance.
Logged


0
Offline Offline
Full Member
***
Karma: 0
Posts: 235
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
. The phi-menu has been rewritten and expanded to the phi_prompt smiley Please find the most recent phi_prompt library here:

http://code.google.com/p/phi-prompt-user-interface-library/

Get the 1.0 pre-release and the doc of the previous edition. I am still working on the new doc. The library comes with plenty of sample codes to get you started.
I will try this out soon...  smiley-grin

Quote
Only concern about your plan I have is that if you use i2c master slave, then the slave end can't read its RTC since the RTC is on i2c and a slave can read at will. Have you thought about that or do you only need RTC on master, which is fine?

Oh dear! Thanx for the heads up. I really hadnt thought of this problem.  smiley-eek-blue Oh this does put me in a pickle. I wanted slaves also to have an RTC.  smiley-sad Now gotta think about how to go about it.  smiley-sad  any suggestions?? One idea that comes to mind is make master only as RTC and send time to slaves over i2c?

@liudr U think I should stick on with i2c. Still distance is problem right??  smiley-sad

Quote
The RJ45 Porto should take care of connecting things up at long distance.

I didnt quite get this.  smiley-neutral

Logged

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 76
Posts: 7307
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey,

I am pretty sure that with proper cabling I2C can easily go up to maybe order of 10 feet or 4 meters. All PC monitor cables with extension cables are examples of such arrangement. An I2C EEPROM on the monitor gets powered by the PC video card so the video card knows what display modes are available. I don't remember whether the cables are shielded or not though. What I meant my phi-2 shield has 2 RJ45 positions to integrate these connectors and you can use the much more reliable ethernet cords as your I2c bus, compared with loose wires. Just use a twisted pair for SCL/GND and another pair for SDA/GND and use the other pairs all for GND if the slave has its own power. I suggest you use a stronger pullup on the bus, say 2K ohm. Then Use ethernet of various lengths to test out the reliability of your direct connect without an I2C extender. Otherwise, how about using software serial over the ethernet cord? You can always reduce baud rate if you have too much noise.



The above picture has my phi-2 shield with 20x4 display and one ethernet (RJ45 socket) on the bottom right. It's much more reliable with loose wires. The LCD pictured is running a menu with phi_prompt library BTW.
Logged


0
Offline Offline
Full Member
***
Karma: 0
Posts: 235
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

No...  smiley-sad I need more than 4m. So  length is still a problem.. My question is has anyone reliably tested those i2c bus extenders and does it really work?? Is there any good tutorial for that? If thats not the case Is there any other form of communication I might use with enough Background literature support?
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 227
Posts: 14051
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

switch to rs485 for distance (at the price of speed)

- http://www.lammertbies.nl/comm/info/RS-485.html -

have a look at the table in the middle (be aware that this will depend on your cabling..)
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 76
Posts: 7307
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Try I2C on twisted pairs first to see how far you can push at 100KHz frequency. Without testing it's hard to say for sure.
Logged


0
Offline Offline
Full Member
***
Karma: 0
Posts: 235
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
switch to rs485 for distance (at the price of speed)

So if I switch over Rs 485 is there any libraies floating around or would I have to define my own communication schema?

Quote
Try I2C on twisted pairs first to see how far you can push at 100KHz frequency. Without testing it's hard to say for sure.

How do I change the frequency of transmissions?
Logged

London
Offline Offline
Full Member
***
Karma: 0
Posts: 146
Ugi was not declared in this scope
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

For your RTC, have you considered the DS1302?

It's a battery-backed RTC with built-in trickle-charging circuit and you communicate with any normal digital pins - no need to use the I2C.

There are libraries around for driving them such as here: http://quadpoint.org/projects/arduino-ds1302 (google is yoru friend).  I managed to write some simple functions to drive it pretty easily.

£4 for 10 chips on ebay if you can wait for them to come from China! Only issue I found is that they are spec'd for 6pf watch-crystals rather than the more common 12.5 pf.  Crystals are available, however, and again if you can wait for them from HK, they're dirt-cheap.
« Last Edit: March 02, 2012, 12:25:39 pm by Dr_Ugi » Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 549
Posts: 27434
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

You can also get RTCs that use SPI instead. No xtals needed, just a power pin decoupling cap.

http://www.maxim-ic.com/products/timers/ds3234.cfm

Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 76
Posts: 7307
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I thought you can define the I2C bus speed in wire.h?! The layer of wire library is like an onion and I'm not thrilled to do the peeling today. Anyone with a ready answer?
Logged


Pages: [1] 2   Go Up
Jump to: