Master Slave Project

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

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

  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 :frowning: ) 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. :frowning:

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

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

If there are new libraries to do the foll or so plz do let me know

a human year equals an arduino century so :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 ?

robtillaart:

If there are new libraries to do the foll or so plz do let me know

a human year equals an arduino century so :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... :wink: Yup I have used that Master Slave thing in other projects... :slight_smile: Any help regarding its distance or other topics I mentioned??

  1. 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...

PMed him.. :slight_smile: Regarding i2c anyone?? :frowning:

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

RTC, and 162 or 204 display. The RJ45 Porto should take care of connecting things up at long distance.

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

Google Code Archive - Long-term storage for Google Code Project Hosting.

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:

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. :fearful: Oh this does put me in a pickle. I wanted slaves also to have an RTC. :frowning: Now gotta think about how to go about it. :frowning: 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?? :frowning:

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

I didnt quite get this. :expressionless:

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.

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

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

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

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.

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?

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?

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: Redirecting to 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.

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

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?

Thanx U guys for the info... Appreciate it.. :slight_smile:
Problem is when I try to go into any other form of communication (non i2c) I am running out of I/O pins. :frowning: So I think I might need to rethink about the project and maybe redo the designwork a bit... :frowning:

000:
Thanx U guys for the info... Appreciate it.. :slight_smile:
Problem is when I try to go into any other form of communication (non i2c) I am running out of I/O pins. :frowning: So I think I might need to rethink about the project and maybe redo the designwork a bit... :frowning:

If you decide to do this without costing all your pins, I have a proven method that can both save a ton of your pins and a ton of your arduino sketch space, for a small price:

Use the phi-panel serial LCD keypad panel. It is my design by the way. You use two serial lines (soft or hardware) to connect to this panel, you send in info to display. The on board firmware can render select menu just like the phi-menu or the new phi_prompt. You save ton of sketch space on arduino by not having to include liquidcrystal or phi_prompt, just have some strings in the sketch and send to the panel so the panel handles all button pushes and return a choice you make. Your arduino can do other things while waiting for a user response. The basic solution is only $12 and sparkfun's serLCD can't compare with 10% what my panel does and costs twice as much.

There are three models:

backpack with keypad connector and compatible with 16x2 or 20x4 displays

compact panel with 16x2 display and integrated keypad
full panel with 20x4 display and integrated keypad

I'm not ashamed of advertising my design. A lot of people like these and they become returned customers. It's just that not many know of the panels.

Hi liudr,
Have you considered a graphics panel? I was just looking around at New Haven Display, they all seem to be parallel interfaces.

000,
I have some boards coming in anyday now (shipped already) that use a '1284 chip in a duemilanove style board layout.
Provides 2 hardware serial ports and 10 more IO pins overall. Would that help things?

All thruhole for easy assembly. Different options supported for a USB/Serial adapter if your project needs that.

Must say I haven't experimented with long distance I2C, but perhaps using I2C bus extenders might be an idea. The datasheet of the P82B715 I2C bus extender talks of communication over a twisted pair wire with length of 50m/160ft. It seems quite easy to work with and the price (at Mouser, haven't looked further) also seems reasonable.

CrossRoads,

Yes. I am. On the other hand, I am mostly thinking about making industrial control panels but I am discouraged when thinking about all the graphic controls and indicators classes I have to code. Maybe I will make a text based panel on glcd and expand into graphic interface later. I spend too much effort to make things perfect and yet my products are unknown to most people that could really enjoy them. So is this your recent design? Thinking about selling thru some online stores?