• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Arduino In Action Question

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have been developing projects with the Arduino for six months now and have progressed fairly far. My son and I built a autonomous robot that uses sonic distances sensors, infra red sensors, temperature sensors and microphones to navigate a maze. It is quite a good project for us to have learnt the basics. I am now wanting to progress onto having more than two Arduino communicating with each other and with a computer. What is the best way of doing this? Should I use the SPI bus or the I2C bus for the communication between the micro controllers?
 
author
Posts: 15
7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Gavin

it will depend on the specifics of your project. For example how far the Arduinos are apart there are a variety of communication protocols you could use including good old serial.
 
Gavin Ross
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the reply.

Would serial comms handle using a single channel/port to address multiple linked devices. I want to send a bitstream which inludes, as the first two bytes, the address of the micro controller that it refers to. Only if the address matches its internal address, will the micro controller respond else it will ignore the comms. Or would I need to have each micro controller action the serial event and either respond or send it to the next device in the chain on a different port?
 
Bartender
Posts: 1166
17
Netbeans IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Gavin Ross wrote:
Would serial comms handle using a single channel/port to address multiple linked devices. I want to send a bitstream which inludes, as the first two bytes, the address of the micro controller that it refers to. Only if the address matches its internal address, will the micro controller respond else it will ignore the comms. Or would I need to have each micro controller action the serial event and either respond or send it to the next device in the chain on a different port?



I am implementing a ring system using serial ports. Each device in the ring has an ID (in my case a letter in the range 'a' to 'z') and commands are sent along the ring and either swallowed by the device when the ID matches or passed to the next device in the ring. Devices send results along the ring to the computer which itself is a device (ID == 'z'). I have a Java program on the PC which generates commands and displays the results. Currently I only have 5 devices in the ring (a PC as controller, a Raspberry Pi, a Mega 2560 and two devices based on PIC16F628A) but I hope to be able to expand this. I would like to have used I2C but the PIC16F628A chips do not have built-in I2C and I'm not keen on 'bit banging'. My protocol looks a bit like I2C with each record having the device ID as the first character and then the rest of the record depends on the device but terminated by a '\n'. I'm running this at 115200 Baud. Currently I don't have a checksum of any sort but I'm probably going to have to add one. I typically have about 10 commands of around 10 bytes per second which means I have plenty of spare capacity but I don't know how well this will scale; probably not well.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic