Pages: [1]   Go Down
Author Topic: Small microcontroller with UART  (Read 834 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Full Member
***
Karma: 0
Posts: 200
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello everybody.

My new project is about a network of PIRs.
I'm looking for a small/cheap micro able to manage a 9600 bps communication and to read/write two 5v signals
The idea is to make a half duplex communication bus with 10 to 50 pirs sensors like this: http://dx.com/p/ir-infrared-motion-detection-sensor-module-dc-5v-20v-139624
One master (arduino) ask each slave getting its status.
Communication will be trough rs485 signals (max485)
I prefer a micro with no resonator/external components needed.

What micro do I need?
Can be that micro programmed with arduino ide?

Thank you very much.
Logged

Leeds, UK
Offline Offline
Edison Member
*
Karma: 71
Posts: 1638
Once the magic blue smoke is released, it won't go back in!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The Atmel ATTiny2313 springs to mind. It is supported by several third party arduino cores and has a Hardware UART module along with an 8MHz internal oscillator.

It is larger than the ATTiny84 or ATTiny85 in that it has 20 pins, but it does have a hardware UART which the others don't.

Datasheet: http://www.atmel.com/images/doc2543.pdf



You could use an ATTiny85, but you would be limited by the fact that it requires a software based UART. This isn't a major issue as you are using Half duplex. The Attiny85 is an 8pin uC so is very compact. There are 5 digital pins which should be enough (TX, RX, Direction, and your two 5v signals)
My attiny core does have a software serial port built in which runs on an interrupt so fairly well represents the hardware UART with the limitation that it is half duplex, but that shouldn't cause you an issue. The core can be found here: https://github.com/TCWORLD/ATTinyCore
« Last Edit: May 06, 2013, 01:54:58 pm by Tom Carpenter » Logged

~Tom~

0
Offline Offline
Full Member
***
Karma: 0
Posts: 200
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Nice.
Thanks.

ATTINY2313V-10PU or ATTINY2313-20PU ?

MOD:
ATtiny85 with softserial??? Nicer!
Does it need external resonator?
« Last Edit: May 06, 2013, 02:00:05 pm by Jose Francisco » Logged

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 118
Posts: 4537
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Nice.
Thanks.

ATTINY2313V-10PU or ATTINY2313-20PU ?

Whichever you can get cheaper.

MOD:
ATtiny85 with softserial??? Nicer!
Does it need external resonator?

The forums are full of people who can't get it working. No AVR chip *requires* an external resonator, though it can fix a lot of problems with things that need accurate timing, eg. softserial.
Logged

No, I don't answer questions sent in private messages...

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 121
Posts: 8430
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Have a  look at the ATtiny1634, still 20 pins but I2C, TWO serial ports and a 12-channel ADC, I suspect that the 2313 won't be used much in future smiley

All it's missing I think is real SPI.

_____
Rob
Logged

Rob Gray aka the GRAYnomad www.robgray.com

0
Offline Offline
Full Member
***
Karma: 0
Posts: 200
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Will I need external timing with attiny85?
Will I need external timing with attiny1634?

Thanks
Logged

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 118
Posts: 4537
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Will I need external timing with attiny85?
Will I need external timing with attiny1634?

No.
Logged

No, I don't answer questions sent in private messages...

United Kingdom
Offline Offline
Tesla Member
***
Karma: 220
Posts: 6587
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Will I need external timing with attiny85?
Will I need external timing with attiny1634?

No, but it will be easier with external timing.

To operate reliably, the transmitter and receiver need to be using the same bit period within +/- 2% (see http://pdfserv.maximintegrated.com/en/an/AN2141.pdf). Your master is an Arduino, so assuming it uses a ceramic resonator (e.g. Uno) then its clock frequency tolerance will be +/- 0.5%. This means that your ATtinys must have a clock frequency that is accurate to within +/- 1.5%.

The easiest way to achieve this is to use a 3-terminal ceramic resonator on each ATtiny. However, this uses up 2 pins.

The other way is to use the internal clock in the ATtinys, but calibrate it using the OSCCAL register. The clock accuracy of the ATtiny as-shipped is guaranteed to be no worse than 10% @ 3V. You will need to use a regulated supply to feed the ATtinys, because the clock frequency is voltage-dependent. Also, the temperature had better not fluctuate too much, because the clock frequency varies with temperature.

An alternative is to use a self-clocking protocol instead of standard async protocol. if each transmission starts with several alternating 0s and 1s then the receiver can measure the bit length with respect to its internal clock, removing the need for an accurate clock frequency.
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 118
Posts: 4537
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Will I need external timing with attiny85?
Will I need external timing with attiny1634?

No, but it will be easier with external timing.

Yes. If the whole point of doing this is to use serial ports then you should plan for an external crystal. Anything else will most likely lead to pain.

Logged

No, I don't answer questions sent in private messages...

Pages: [1]   Go Up
Jump to: