LumiNet (based on attiny84)

That would be great a working servo libary for the attiny :slight_smile:

As for development, i'm going to use the breadboard first ofcouse.
(ive already done it with a normal arduino)

Then im going to solder it on a experimenters board.
Im trying to make within 4.5 by 3 cm or smaller.
The servos and ir-receiver are connected with wire.

This is the code i use for the IR http://www.rjw.speedxs.nl/arduino/lego_reciver.pde
With the ladyada motor schild to drive motor's

Instead of lego motor's im going to drive servo motor's on the same protocol.
Thats why size matters, it has to fit in a lego block ;D

I have placed a order for the attinys and rest of the components
I am exited to test it.

To get it running on 8mhz, i have to remove the "Divide clock by 8 internally; [CKDIV8=0]" in the fuses?

Also i noticed you have disabled the brown-out detection.
All arduino fuses have it enabled. Is there a reason for it?

Yeah, you should remove that.. Took me some days to realize that this option made my Single Chip Arduino's timings go crazy!!! ;D

Of course you must select the 8mhz clock setting, which is selected by default! :stuck_out_tongue:

Yes, LumiNet nodes run at 8MHz.
You can also change the clockspeed at runtime in the setup() function. In order to run the attiny84 at 8MHz you can use this piece of code:

cli();
CLKPR = (1 << CLKPCE);//INITIALIZE CLOCK CHANGE
CLKPR = 0x00;//NO PRESCALER

You can find more information in my diplom thesis (on the LumiNet homepage) at page 66.

I don't use brown-out detection on LumiNet nodes... I don't need it, but of course you can activate it if you wish to... should make no difference for most applications.

I will have a look at the servo lib soon.

ok, I'm finally ready to build something with the attiny84 support. A couple of questions:

  1. I understand the arduino pin assignments as follows:
    ATTINY pin 2 is arduino digital 3
    ATTINY pin 3 is arduino digital 2
    ATTINY pin 4 is arduino digital 11 (also the attiny's reset)
    ATTINY pin 5 is arduino digital 1
    ATTINY pin 6 is arduino digital 0
    ATTINY pin 7 is arduino digital 10
    ATTINY pin 8 is arduino digital 9
    ATTINY pin 9 is arduino digital 8
    ATTINY pin 10 is arduino digital 7
    ATTINY pin 11 is arduino digital 6
    ATTINY pin 12 is arduino digital 5
    ATTINY pin 13 is arduino digital 4
  2. I need two external interrupts
  • Pin 5 of the attiny84 is labeled INT0, does that correspond to arduino interrupt 0?
  • Can I use the pin change interrupt support for my other interrupt - say on the attiny84's pin 13?
  1. I need one analogRead - does this work and which pin is Analog 0? I looked in wiring_analog.c but it's not obvious.

Thanks for the help

You can see the pin mapping in the hardware/cores/luminet folder - in the file pins_arduino.c

// Luminet board
//                *   *
//                D0  D1
//            VCC PA7 PB2 GND
//             |   |   |   |
//             |   |   |   |
//    VCC---                   ---VCC
//D7  PA3---                   ---PB1  D2
//D6  PA2---                   ---PB0  D3
//    GND---                   ---GND
//             |   |   |   |
//             |   |   |   |
//            VCC PA1 PA0 GND
//                D5  D4
//
// red   led:   PA4 (d8) -- pin available if jumper is not connected
// green led: * PA5 (d9)  -- pin available if jumper is not connected
// blue  led: * PA6 (d10)  -- pin available if jumper is not connected
// reset:       PB3 (d11)

The attiny pin depends on your ic size. The following table might make the mapping more clear:

Arduino Pin # tiny84 pin name
0 PA7
1 PB2
2 PB1
3 PB0
4 PA0
5 PA1
6 PA2
7 PA3
8 PA4 -- red led
9 PA5 -- green led
10 PA6 -- blue led
(11) (PB3) -- reset

Analog Pin 0 is PA0 (this is Arduino Pin # 4 corresponding to the table above).
So analogRead(0) reads the analog value from PA0.

pin change interrupts are not supported at the moment (only for attiny2313), but I can add this within minutes if you really need it. You can find the code for the interrupt handling in the file WInterrupts.c in your hardware/cores/luminet folder.

Using pins other than INT0 or INT1 for pin change interrupts is not supported by any Arduino hardware at the moment, I guess. But I can add this if you are sure whar you are doing. INT0 and INT1 are far better than the interrupts on the other pins.

The following table might make the mapping more clear:Arduino Pin # tiny84 pin name
0 PA7
1 PB2
2 PB1
3 PB0
4 PA0
5 PA1
6 PA2
7 PA3
8 PA4 -- red led
9 PA5 -- green led
10 PA6 -- blue led
(11) (PB3) -- reset

Ok that helps a lot.

Analog Pin 0 is PA0 (this is Arduino Pin # 4 corresponding to the table above).
So analogRead(0) reads the analog value from PA0.

OK that's great.

pin change interrupts are not supported at the moment (only for attiny2313), but I can add this within minutes if you really need it. You can find the code for the interrupt handling in the file WInterrupts.c in your hardware/cores/luminet folder.

Using pins other than INT0 or INT1 for pin change interrupts is not supported by any Arduino hardware at the moment, I guess. But I can add this if you are sure whar you are doing. INT0 and INT1 are far better than the interrupts on the other pins.

I'd like to use int0 and int1 but i only see int0 on the pinouts - am I missing something? I just need to be able to respond to pulses from two different sources.

I'd like to use int0 and int1 but i only see int0 on the pinouts - am I missing something? I just need to be able to respond to pulses from two different sources

Yeah, I had the same problem. I need to count pulses from encoders so I need at least 2 interrupts. I decided to go for a tiny2313, but it looks it was a big mistake, since the code doesn't fit in the tiny 2k flash... Now I redesigned the board and I'll go for tiny861 that has 2 interrupts, TWI and enough space for the code. All I need now is to figure out how to change the tiny84 and tiny2313 files for tiny861. I could ask bohne nicely, but I'd like to try it out myself first. But I think this tiny might work for your project too.

Yeah, I had the same problem. I need to count pulses from encoders so I need at least 2 interrupts.

Did you think about using the pin change interrupts? It doesn't look THAT hard.

the attiny861 does look like it would do everything I need but now we're up to 20 pins and another new, non-standard chip(which I don't have one of anyway!). For the moment I'm going to keep plugging at the 84 and if I can't make that work I'll just have to squeeze in a 168/328. I don't think I could fit in the 2313 either.

I must say, as I go through this process, I'm impressed with the design of the 8/168/328 chips and their selection for the arduino. It really does seem to be a sweet-spot for small-ish size with lots of function built in.

Hi,

This is very interesting topic and I'm trying to study this.

I got my small program working fine with arduino. Now I would like to put it ti attiny 2313. I have downloaded all the software from luminet.

I still don't understand how do I put my 'blink' program to attiny 2313. Is is possible if somebody can explain step by step how to do it and make the LED blink.

I have

  • modified arduino diecimila which can program bootloader to itself using bitbang.
  • attiny 2313 chip
  • all the basic electonic components

Is is possible to put the 'blink' to attiny with this available HW?

ive got my attinys, only i dont get it to work.
I have successfully uploaded the sensor bootloader.
Only i can not upload sketches on pin 6&7

Im using a usb to ttl cable. Hooking the tx/rx to the tiny and using the auto reset with a 100n cap.

There 3 bootloaders, there the confusion start (maybe a idea to release a standalone version)

What bootloader do i need? i want to use the bootloader to upload sketches. I and i have to recompile it for 8mhz?

Looking to the pins_arduino, there is nothing on the digital_pin_to_timer ? thats for pwm?

When i get blink to work im very happy, then i can look to interrup for my ir-sensor :smiley:
And if that is done, its the servo-motor haha

Ive tried to upload the blink with the icsp.
Uploading going fine, but no blink

ive tried pin 0 and 4.
I have put a multimeter on all pins of the tiny, nothing is high

Also i changed the arduino_pins there only 11 usable pins, your have much more, so i changed it to 11 and put it in a nice order, but still does not work

i have successfully compiled a "blink" for the attiny84 then loaded it with avrdude and an icsp type programmer.

the attiny had only power, ground, the programming pins and a led hooked up.

there is no bootloader used, just the bare ivr. i was not able to get the ide to do the upload but that may have been my homebrew programmer. i get the impression that the ide will happily drive a programmer - the bootloader emulates one of the protocols that's used by the programmers.

I also believe there are bootloaders for the attiny's but i don't have one.

Ive got blink working now. Seemskeeping the icsp cable on it didnt work.

Well, ive got my next problem, the external interrupt (INT0)
Seems it doesn't work.
Looking in the corefile (Winterrupts) its disabled.
With the help of the data-sheet I tried to get it back, with no luck.

So i have a request, Seems i only do that ;D

Can you make like the tiny2313 a clean core file for the tiny84?
With interrupt enabled, and maybe pwm.

Thanks!

Hi,

sorry for the delay - a lot of work here...

I am working on an integration of the attiny family into the latest Arduino IDE. In the same step I will offer a new Arduino core - a pure attiny84 core with interrupts and pwm instead of bynase for analofWrite()...

Please be patient, this core will be release early in Sept. 09 ( I guess 06.Sep.2009 will be the release date). So stay tuned for updates on www.luminet.cc

hey that would be great - thanks for the update.

and, and, a BOOTLOADER! Can we have a BOOTLOADER?

Well I couldn't wait for you till you released a clean core file...so I have made one ;D
It was more for the leaning experience, setting timers, interrupts, pwm etc. Much fun.

I have tested most that I could, no guarantee its bug-free in the first time. :smiley:
Its for IDE 0017.
I have the atttiny running @ 8mhz internal xtal.
fuses:
low=0xe2
high=0xdd
extended=0xff

Core file: http://85.12.32.240/~superkoe/arduino/attiny84/attiny84-0.1.zip

extract it in arduino/hardware/cores/

##############################################################

attiny84.name=ATtiny84

attiny84.upload.protocol=stk500
attiny84.upload.maximum_size=8192

attiny84.bootloader.low_fuses=0xe2
attiny84.bootloader.high_fuses=0xdd
attiny84.bootloader.extended_fuses=0xff
attiny84.bootloader.path=attiny84

attiny84.build.mcu=attiny84
attiny84.build.f_cpu=8000000L
attiny84.build.core=attiny84

Add this at the end in programmers.txt in hardware.

The pins: (dip14)

                     +-\/-+
               VCC  1|    |14  GND
          (D0) PB0  2|    |13  AREF 
          (D1) PB1  3|    |12  PA1 (D9) 
             RESET  4|    |11  PA2 (D8) 
INT0  PWM (D2) PB2  5|    |10  PA3 (D7) 
      PWM (D3) PA7  6|    |9   PA4 (D6) 
      PWM (D4) PA6  7|    |8   PA5 (D5) PWM
                     +----+

The PA ports are also analog inputs. so PA0 = 0 and PA7 = 7
The INT0 is the Interrupt port.(there is only 1)

could you post the core file in zip or plaintext and could you explain it or explain how to understand it? That's a lot to ask i'm sure but people would appreciate it I bet.