Go Down

Topic: Master Slave Project (Read 4 times) previous topic - next topic

0

Hi all... Hope you all are fine... Its been nearly a year since I got back to Arduino and to its forum... :D Happy to be back...  :)

I am free for around a months time from now. So thought of coming to Arduino to do a project. :)
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... :)
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 :) )
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 :( ) 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. :(

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. :(

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


robtillaart

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 ;) 

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 ?

Rob Tillaart

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

0


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 ;)  

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... ;) Yup I have used that Master Slave thing in other projects...  :) Any help regarding its distance or other topics I mentioned??

robtillaart

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...
Rob Tillaart

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

0

PMed him..  :) Regarding i2c anyone??  :(

liudr

Hey welcome back! PM received. The phi-menu has been rewritten and expanded to the phi_prompt :) 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.

0

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...  :D

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.  :( Now gotta think about how to go about it.  :(  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??  :(

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

I didnt quite get this.  :|


liudr

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.

0

No...  :( 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?

robtillaart

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..)
Rob Tillaart

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

liudr

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.

0

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?

Dr_Ugi

#12
Mar 02, 2012, 06:22 pm Last Edit: Mar 02, 2012, 06:25 pm by Dr_Ugi Reason: 1
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.

CrossRoads

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

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.

liudr

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?

Go Up