Go Down

Topic: microcontrollers for RS485 (Read 2 times) previous topic - next topic

inoukdemers

Jun 11, 2012, 07:19 pm Last Edit: Jun 11, 2012, 07:41 pm by inoukdemers Reason: 1
Hello everyone,

I posted something a week ago on a new project I'm working on: 8 QRD1114 optical sensors spread out in a room, all linking back to the Arduino (and then sending serial data to Max/MSP software on the computer). Connecting the Arduino to a MAX485 chip, I could convert RS485 incoming sensor data (running through about 50 feet of cable) to TTL for the Arduino.

From what I've read, the best setup would be to daisy-chain all the sensors to MAX485, with each sensor communicating back to MAX485 through to its own microcontroller. Each microcontroller would need its own address. The projects I've seen online seem to use Arduinos at all nodes, but for me this would be too expensive. Can anyone recommend some small, inexpensive uC's for the job? They would have to work with RS485, be relatively easy to program, and be able to have an address assigned to them (maybe they all do the latter, I'm new to this).

Maybe ATtiny85? Apprently those are programmable with Arduino. Maybe I could even hook up 3 or 4 sensor inputs to one of those.

The sensors would be used for coin drop purposes, running at about 9600 baud, so the Arduino would need to monitor the sensors continuously (receive mode only).

Thanks for your help!



pylon

A simple Arduino (not a pre-built one as the UNO but a "self-made") cost you about $5 plus about $4 for the MAX485. Your whole network of sensors cost you less then a hundred bucks then including your main Arduino.

And who told you that you must have RS485 to connect them? 15m of cable shouldn't be a big problem with a standard TTL signal if you include some error correction into your software. So you could use a simple two wire signal (I2C) with a low signal rate.

inoukdemers

Pylon, thanks for the reply.

If possible, to save time I'd like to avoid making my own Arduino; also, chips like the ATTiny go for about $2.50 -  call me cheap ;-)

Maybe there are chips that send TTL, but because the site for the installation is in a museum in Germany, I'd like to err on the side of caution and use something that can handle longer distances, just in case.

I'd read about I2C - seems that was designed more for "on board" lengths, with power being supplied individually at each node?


pylon

I don't see your price calculation. The amount of work to make an ATtiny work is about the same as an ATmega328 (ok, maybe a cap and a resistor less) and the ATmega costs about a dollar more. Think about how much time you need to optimize your code to live with the smaller memory (and less pins probably) and you wanted to have spent that dollar.

I wouldn't use I2C itself (it's about 10 times faster than what you need) but build it with standard digital IO pins. Usually I2C has one set of pull-ups per bus, power distribution is separate.

Coding Badly

Quote
Can anyone recommend some small, inexpensive uC's for the job?  ... The sensors would be used for coin drop purposes, running at about 9600 baud, so the Arduino would need to monitor the sensors continuously (receive mode only).


Your "job" description is inadequate.  At this point, it's impossible to tell if a per-sensor microcontroller is even necessary.

Generally, what works best is for you to describe what you want to accomplish starting from the user's perspective.  What you've described is only from the designer's perspective.  In other words, you have yet to tell us what problem you are trying to solve but instead told us what you think the solution is.

Go Up