Pages: 1 [2] 3   Go Down
Author Topic: University project needs help: Serial Communication between arduinos  (Read 3731 times)
0 Members and 1 Guest are viewing this topic.
Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 535
Posts: 27046
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

Your first picture (the schematic) showe fine, the 3D sketch did not, I can't tell you what was different about them.

So you would need blocks that contact pins on at least 3 faces then - the connecting face, the opposite side face, and at least 1 side face so you can change direction. 4 contacts per face.
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.

Florida
Offline Offline
Sr. Member
****
Karma: 4
Posts: 431
hookedup!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

From reading this ...
Quote
every block contains a RGB-LED, it will get a random color at the beginning.
I was thinking the block would be lit up before it was connected by self initializing.   Not sure I understand the complete concept in that respect.    What / when sets the random color and how does it remember it?
Logged

Offline Offline
Newbie
*
Karma: 2
Posts: 14
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@Richard Crowley:
thanks that's a nice idea, we can use that for the concept

@CrossRoads:
we though about different configurations of blocks, some having 1 or 2 connectable faces, some having just one but therefore changing the direction necessarily.

@marklar:
sorry forgot to mention, at the beginning they get the color when being still "in the box", some sort of chocolate-box-shaped console with all unused blocks in it that would assign the colors and also gives the player the information about his score etc. For the moment of disconnecting the block from the console and connecting it to the hub/other block, the LED will be powered by a condensator. This works for approx. half a minute, which should give the player enough time to find a place for the block.
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 535
Posts: 27046
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

The block could all be powered up prior to starting the game, they check if have no neighbors, run rgd random color assignment, store in eeprom. Then when get powered up in the game, they check to see they have a neighbor, if so read eeprom and turn on their color.
I'm thinking maybe give each face a set of header pins, one horizonal, one vertical, males on 3 faces and females on 3 faces.
Arrange the pins so that they could mount either direction
gnd-vcc-rx-tx-tx-rx-vcc-gnd on the females, then on the males gnd-vcc-tx-rx. The males would go one orientation into the females make the connection, boot up & do its color thing, and then have gnd-vcc-etc, available for the next device.


* game_cubes.jpg (36.94 KB, 641x468 - viewed 11 times.)
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.

Offline Offline
Newbie
*
Karma: 2
Posts: 14
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

this is what we have figured out so far as well, but the problem was (or is) that we don't get the communication working.

the best solution of all would be, if we'd find a solution to avoid one arduino for each block  smiley-confuse
Logged

Florida
Offline Offline
Sr. Member
****
Karma: 4
Posts: 431
hookedup!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

How many colors do you want?  If you want more than the basic 7 (r g b y c m w) then you will need PWM control over the leds.  If you only want R G or B then that makes it easier (potentially less connections / logic).

Does every block need a unique address so you can pull in the final structure details to the central brain?

Is there a limit to the number of blocks that can be stacked in one direction (or leg)?

Thinking through EEPROM (24LC256) options there may be a way to use an arduino for each leg.  The connections would create a "bus" for that leg that would talk 2wire to the EEPROM.  When the RGB values are set, so is the EEPROM value.  When a new block is added, the arduino on that leg would read the EEPROM and if compare with the last added.  In order to actually change the RGB color to flash or otherwise notify the user, that would be tougher.  I would suggest with this implementation you go with a central buzzer or light as an indicator of incorrect color.  Lots more to consider, specially the 4 or 8 EEPROM limit per arduino.   In thinking this all the way through I just can't see it working, but figured I'd toss out the basic idea for other (smarter) people to chime in on.

I do wonder if a stand alone Atmega328 chip would be in order here (maybe even with no crystal if 2wire still works).  Sounds like each block is going to take some construction time as it is, building in the chip would allow each one to talk 2wire / have a complete brain but still take up a small space and have a descent price (at under $6 per chip).

You would have to assure your power mechanism can power the LED and the chip both for the 30 second period you mentioned.
Logged

Offline Offline
Newbie
*
Karma: 2
Posts: 14
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Thinking through EEPROM (24LC256) options there may be a way to use an arduino for each leg.  The connections would create a "bus" for that leg that would talk 2wire to the EEPROM.  When the RGB values are set, so is the EEPROM value.  When a new block is added, the arduino on that leg would read the EEPROM and if compare with the last added.  In order to actually change the RGB color to flash or otherwise notify the user, that would be tougher.  I would suggest with this implementation you go with a central buzzer or light as an indicator of incorrect color.  Lots more to consider, specially the 4 or 8 EEPROM limit per arduino.
This sounds like a great idea! It would be totally fine to have just the basic RGB-colors. A maximum stack of 8 blocks per leg would be okay, too (although the more the merrier, bus a prototype who cares). The only difficulty I see here would be that Y-roots (such as having two blocks connected on different sides of one block) won't be possible?
Nevertheless if there was a way to have just EEPROMS in the blocks and get it running like that would already be a great opportunity.

I don't think that a condensator could power the chip as well, the condensators (which are comparable big to achieve anything) struggle with the LEDs already. In the recent concept the Arduino would have no power until reconnected with the hub/other block, which is why it would save important data in the EEPROM so it was not lost.

thanks so far, some great input there!
Logged

0
Offline Offline
Newbie
*
Karma: 2
Posts: 12
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Sounds like you need a lot of arduino's to get your game to work. Although I'm sure you can find ways around that. For now, I would suggest that you need to get your arduinos to communicate in a multimaster configuration, where each arduino has a specific address and is able to send and receive information.I had a similar problem in my project and the Wire library worked well for me. You can just have each arduino search for its neighbor and wait for a response and if no response then it searches for its neighbor's neighbor.   If you are still having trouble getting the Arduinos to communicate using the Wire library here are a few great resources:
http://www.neufeld.newton.ks.us/electronics/?p=241
http://absences.sofianaudry.com/en/node/10
http://www.uchobby.com/index.php/2008/09/16/introduction-to-i2c/

Keith's electronics blog was particularly helpful to me.

And if you want a really dumbed down, step by step explanation of how to do this you can check out my blog where I documented my progress with getting my arduinos to communicate in detail (I'm a newbie so I really go baby step by baby step  smiley)
http://www.alivingarchitecture.com/2010/12/connecting-arduinos-mastermaster/
http://www.alivingarchitecture.com/2011/01/multimasters-sending-receiving-an-array/

good luck!
Logged

Offline Offline
Newbie
*
Karma: 2
Posts: 14
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@psharma:
thanks a lot, that seems like some really useful batch of links! Got a lot to try out tomorrow  smiley-grin
Logged

Florida
Offline Offline
Sr. Member
****
Karma: 4
Posts: 431
hookedup!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The issue I see with eeprom is that if you have blocks 1-8 with a different eeprom address values for each entry .. then you would need four groups of these.  You could not use number 1 of one group and 1 of another group on the same leg.  You could use the microsoft model and call that a "feature" - the sudoku flair.  You would give each one the number 1-8 and part of the rules of the game would have to be you can not use the same number twice in one leg.  Even there you may hit issues with enforcement.  If that won't work .. the whole eeprom idea breaks down.  If you need an arduino or atmega chip for each block .. you have to have power.

Best of luck.
Logged

Offline Offline
Newbie
*
Karma: 2
Posts: 14
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If I understand this right, could I setup a standalone atmega like described here
http://www.arduino.cc/playground/Learning/AtmegaStandalone
but cut off any unnecessary function (such as quartz crystal and voltage regulator in case the power already is regulated, like having all atmega chips connected to a regulated 5V source) and I could get it work the way I'd need an Arduino to? That would be a rather cheap solution
Logged

Florida
Offline Offline
Sr. Member
****
Karma: 4
Posts: 431
hookedup!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

You may want the crystal and the 22pf capacitors but they are pretty inexpensive.  You can then power it directly from a 5volt source and it works just like standard arduino would when running.  Naturally you would need to power it while disconnected. 

After thinking it through, if you can work the power needed .. I'd say this is your best bet. 
Logged

Not USA
Offline Offline
Full Member
***
Karma: 1
Posts: 123
Arduino
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Do you really need serial comms for this at all? Why not have a 'voltage line', that a smart block can pickup via an analog input, then set the right pins for a voltage divider setup for an output? You don't need many pins for other things so you've got them spare.
Logged

3D Artist,Modeler, Texturer, Animator, Electronics and Robotics, Programming C, VB, Website Design, Flash animator

Too many hobbies?

East Coast, USA. (PA)
Offline Offline
Newbie
*
Karma: 7
Posts: 29
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What is your limiting factor for the number of connections per block? Would it be possible to put a simple 10 pin connector on each side?

Picture this:

Each block has a common ground pin and three anode pins for red, blue, green, and passes these connections on through the block's other connectors.

If the leg is to be green, the HUB only provides power to the green anode, so all blocks attached to that leg will light up green.



To determine which side of the block a new block was added on, you need an additional 5 pins (assuming 5 possible sides)

Put a resistor in parallel between each pin and ground on a different pin for each side. For example:

Pin
1 on the front
2 on top
3 on right
4 on bottom
5 on left

If a block is added on the front, the resistance on pin 1 is R.
if a second block is added to the front of the first, the resistance on pin one goes to R/2
If a third block is added on the top of block 2, the resistance on pin 1 is R/2, and the resistance on pin 2 is now R.

Using a voltage divider and the analog input of an arduino you can easily use these R values to compute the arrangement of the blocks when added one by one. If you use different resistances in each block type, you can compute which blocks are where.

In addition, with the use of a multiplexer on the analog inputs, you can control ALL BLOCKS WITH A SINGLE ARDUINO.

Unless there is an extremely compelling reasons to use only 2 pins per block face, I would strongly suggest moving to a multi-pin approach.
10 pin male/female headers and resistors are cheap and abundant, unlike Arduinos.

Hope this helps.

~Andrew








Logged

If architects designed buildings like programmers wrote code, the first woodpecker to come along would be the end of civilization.

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 535
Posts: 27046
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

check dipmicro.com for parts. Liudr in a different topic had a list of parts to go with an RBBB board (I think) and it was quite surprising how little some of the items were.
And yes, the ATMegas run just fine from 5V supplied directly, or 3 AA batteries even. I am running a remote control transmitter on a 3.7V LiPo battery at 8MH, no regulation at all (and others report that 16MHz parts work as low as 3.3V too - but I would guess maybe not over the fully spec'ed temperature range).
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.

Pages: 1 [2] 3   Go Up
Jump to: