Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. My Project
  3. MySensors on ATTINY85

MySensors on ATTINY85

Scheduled Pinned Locked Moved My Project
attiny
24 Posts 12 Posters 18.1k Views 4 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    vtento
    wrote on last edited by
    #8

    MySensors.jpg

    1 Reply Last reply
    0
    • V Offline
      V Offline
      vtento
      wrote on last edited by vtento
      #9

      I share MOSI with 1-WIRE bus, I put in sleep mode the radio, then I read the sensor and after I send the value...
      Unfortunately I can't use only 3 pin for the radio module because I work with a botton battery (I can't swith off) and I need TX and RX

      axillentA 1 Reply Last reply
      1
      • V vtento

        I share MOSI with 1-WIRE bus, I put in sleep mode the radio, then I read the sensor and after I send the value...
        Unfortunately I can't use only 3 pin for the radio module because I work with a botton battery (I can't swith off) and I need TX and RX

        axillentA Offline
        axillentA Offline
        axillent
        Mod
        wrote on last edited by axillent
        #10

        @vtento cool work!

        make sure to avoid floating numbers. also try to not use 32 bit numbers and limit usage of 16 bit numbers
        division by 16 is better to do by >> right shift

        DS18B20 code can be shrinked up to 400-500 bytes while some in examples it is eating 1-2k

        sense and drive

        1 Reply Last reply
        0
        • V vtento

          I have already taken done to cut any library where possible (serial debug, utility / LowPower) I have already rewrite interrup WDT for sleep mode and pin change...
          Now I can only hope to take some byte from the arduino bootloader, but I don't know how?

          tekkaT Offline
          tekkaT Offline
          tekka
          Admin
          wrote on last edited by
          #11

          @vtento said:

          I have already taken done to cut any library where possible (serial debug, utility / LowPower) I have already rewrite interrup WDT for sleep mode and pin change...
          Now I can only hope to take some byte from the arduino bootloader, but I don't know how?

          Due to space constraints, I would omit the booloader and use the entire space for the sketch. However, the smallest bootloader is 0.5kb (Optiboot) and if OTA updates are important, then MYSBootloader (2kb). That said, it all depends how much you manage to squeeze the library code.

          1 Reply Last reply
          0
          • J Offline
            J Offline
            Joseph Macaulay
            wrote on last edited by
            #12

            Hi, can you share any of the source code you got running on the ATTiny85? I've got 5 ATTiny85s & 5 ATTiny84s. I've been running the TMRH20 RF24, Network, and Mesh on them, but I wanted to see if I can use the MySensor stuff. Thanks!

            axillentA V 2 Replies Last reply
            0
            • J Joseph Macaulay

              Hi, can you share any of the source code you got running on the ATTiny85? I've got 5 ATTiny85s & 5 ATTiny84s. I've been running the TMRH20 RF24, Network, and Mesh on them, but I wanted to see if I can use the MySensor stuff. Thanks!

              axillentA Offline
              axillentA Offline
              axillent
              Mod
              wrote on last edited by
              #13

              @Joseph-Macaulay the version of RF24 is comming with latest MySensor contains a software SPI driver able to work on tiny MCU

              sense and drive

              1 Reply Last reply
              0
              • J Joseph Macaulay

                Hi, can you share any of the source code you got running on the ATTiny85? I've got 5 ATTiny85s & 5 ATTiny84s. I've been running the TMRH20 RF24, Network, and Mesh on them, but I wanted to see if I can use the MySensor stuff. Thanks!

                V Offline
                V Offline
                vtento
                wrote on last edited by vtento
                #14
                • @Joseph-Macaulay Hi, this is the sketch that I use for Themp sensor

                MySensors85.ino

                1 Reply Last reply
                0
                • M Offline
                  M Offline
                  mrendu43
                  wrote on last edited by
                  #15

                  hello
                  I dont understand why didnt you use reset, and delcare it as input pin?
                  as i know it can be declared as io

                  1 Reply Last reply
                  0
                  • SweebeeS Offline
                    SweebeeS Offline
                    Sweebee
                    wrote on last edited by Sweebee
                    #16

                    Oitzu and I (testing :P) are currently working on the Attiny support. To test you can download this library (the same as the original one except that it includes the attiny).

                    Its working so far.

                    Bugs:
                    Your node id is the same as child id (if you set a different child id, somehow the attiny ignores it and makes it the same as your node id).
                    Sleep is working with interrupt but it does the setup again after wake.
                    Sleep / timer is not yet working.

                    library: https://github.com/Oitzu/Arduino/tree/master/libraries/MySensors (You can replace it with your existing mysensors library)
                    example sketch thats working: http://pastebin.com/xRu2JNQ9

                    wiring:

                                      +-\/-+
                                     1|o   |8  VCC/CE  RED/ORANGE
                     YELLOW  CSN     2|    |7  SCK     GREEN
                     -       SENSOR  3|    |6  MOSI    BLUE
                    BLACK    GND     4|    |5  MISO    VIOLET
                                      +----+
                    
                    T 1 Reply Last reply
                    1
                    • A Offline
                      A Offline
                      Andy
                      wrote on last edited by
                      #17

                      Awsome work Oitzu and Sweebee!

                      Just tried it out and it works perfect :)

                      Have you succeeded with getting the sleep/timer working? I've tried but discovered that my skills aren't good enough.

                      mntlvrM 1 Reply Last reply
                      0
                      • SweebeeS Offline
                        SweebeeS Offline
                        Sweebee
                        wrote on last edited by
                        #18

                        Not yet. Maybe next week. To much work at school right now ^^. But when it works i'll post it here.

                        A 1 Reply Last reply
                        0
                        • SweebeeS Sweebee

                          Not yet. Maybe next week. To much work at school right now ^^. But when it works i'll post it here.

                          A Offline
                          A Offline
                          Andy
                          wrote on last edited by
                          #19

                          @Sweebee Got it working last night (I hope!), I haven't measured the power consumption yet.

                          It doesn't have the resolution of ms. To save battery the attiny85 will sleep for 8 seconds, then wake up and go to sleep again. So if you call gw.deep_sleep(7), it will sleep fox 7x8=56 seconds. It is possible to get a more precise timer by calculating the best combination of sleep timers. For example if you want to sleep a minute, sleep 7x8s=56s and then an additional 1x4s=4, total 60s.

                          It needs some cleaning up and correct naming/commenting/testing e.t.c.

                          void MySensor::deep_sleep(int time) {
                          	// Sleep alternatives:
                          	// 0=16ms, 1=32ms,2=64ms,3=128ms,4=250ms,5=500ms, 6=1 sec,7=2 sec, 8=4 sec, 9= 8sec
                          	int ii = 9;	// sleep 8 seconds at a time.
                          	byte bb;
                          	int ww;
                          	if (ii > 9 ) ii=9;
                          	bb=ii & 7;
                          	if (ii > 7) bb|= (1<<5);
                          	bb|= (1<<WDCE);
                          	ww=bb;
                          
                          	MCUSR &= ~(1<<WDRF);
                          	// start timed sequence
                          	WDTCR |= (1<<WDCE) | (1<<WDE);
                          	// set new watchdog timeout value
                          	WDTCR = bb;
                          	WDTCR |= _BV(WDIE);
                            
                          	// Count some sheeps.
                          	for(int i=0;i<time;i++) {
                          		RF24::powerDown();	
                          		cbi(ADCSRA,ADEN);                    // switch Analog to Digitalconverter OFF
                          		set_sleep_mode(SLEEP_MODE_PWR_DOWN); // sleep mode is set here
                          		sleep_enable();
                          		sleep_mode();                        // System actually sleeps here
                          		sleep_disable();                     // System continues execution here when watchdog timed out   
                          		sbi(ADCSRA,ADEN);                    // switch Analog to Digitalconverter ON
                          	}
                          }
                          
                          1 Reply Last reply
                          0
                          • n3roN Offline
                            n3roN Offline
                            n3ro
                            wrote on last edited by
                            #20

                            has someone tested digispark? That would be to test a lot easier.

                            http://digistump.com/products/1

                            pimatic + MySensors + Homeduino + z-way
                            https://github.com/n3roGit/MySensors_n3ro

                            1 Reply Last reply
                            0
                            • A Andy

                              Awsome work Oitzu and Sweebee!

                              Just tried it out and it works perfect :)

                              Have you succeeded with getting the sleep/timer working? I've tried but discovered that my skills aren't good enough.

                              mntlvrM Offline
                              mntlvrM Offline
                              mntlvr
                              wrote on last edited by
                              #21

                              @Andy said:

                              Awsome work Oitzu and Sweebee!

                              Just tried it out and it works perfect :)

                              Have you succeeded with getting the sleep/timer working? I've tried but discovered that my skills aren't good enough.

                              Hi Fella,
                              I just came across this post several weeks ago , I was looking for a smaller cheaper way of making a binary switch to use with my Veras. After reading the "Great debates" whether an ATTiny 85 could be used for such a purpose, I decide to try what was here and by the individuals who said they had made them work. I built one and powered it with a Li-Ion 3.7 v 4000 Mah battery. I have had it in use now for about a week and so far it works great. I have not been able to make the WDT work but from my test so far , running the ATTiny and nRF24l01+ from a Li-ION 4000 Mah battery , it should last for months. Now the the entire circuit is drawing 6.0 ma and when tripped the unit drew 7.5 ma. Now I am sure the current was higher than 7.5 ma when in transmit but it would be for just a very small amount of time. Thanks for the leg work you guys did to make this project for me happen.

                              1 Reply Last reply
                              0
                              • SweebeeS Sweebee

                                Oitzu and I (testing :P) are currently working on the Attiny support. To test you can download this library (the same as the original one except that it includes the attiny).

                                Its working so far.

                                Bugs:
                                Your node id is the same as child id (if you set a different child id, somehow the attiny ignores it and makes it the same as your node id).
                                Sleep is working with interrupt but it does the setup again after wake.
                                Sleep / timer is not yet working.

                                library: https://github.com/Oitzu/Arduino/tree/master/libraries/MySensors (You can replace it with your existing mysensors library)
                                example sketch thats working: http://pastebin.com/xRu2JNQ9

                                wiring:

                                                  +-\/-+
                                                 1|o   |8  VCC/CE  RED/ORANGE
                                 YELLOW  CSN     2|    |7  SCK     GREEN
                                 -       SENSOR  3|    |6  MOSI    BLUE
                                BLACK    GND     4|    |5  MISO    VIOLET
                                                  +----+
                                
                                T Offline
                                T Offline
                                ted
                                wrote on last edited by
                                #22

                                @Sweebee
                                Do you mind sharing your library again? The link is no longer working.

                                1 Reply Last reply
                                0
                                • OitzuO Offline
                                  OitzuO Offline
                                  Oitzu
                                  wrote on last edited by
                                  #23

                                  @ted you are probably searching for this: https://github.com/Oitzu/mysensors-Arduino-attiny/tree/master/libraries/MySensors

                                  But i need to seriously warn you, it is horribly outdated. The repository do not got the love it needed. ^^

                                  T 1 Reply Last reply
                                  1
                                  • OitzuO Oitzu

                                    @ted you are probably searching for this: https://github.com/Oitzu/mysensors-Arduino-attiny/tree/master/libraries/MySensors

                                    But i need to seriously warn you, it is horribly outdated. The repository do not got the love it needed. ^^

                                    T Offline
                                    T Offline
                                    ted
                                    wrote on last edited by
                                    #24

                                    @Oitzu

                                    Thanks!!

                                    1 Reply Last reply
                                    0
                                    Reply
                                    • Reply as topic
                                    Log in to reply
                                    • Oldest to Newest
                                    • Newest to Oldest
                                    • Most Votes


                                    21

                                    Online

                                    11.7k

                                    Users

                                    11.2k

                                    Topics

                                    113.1k

                                    Posts


                                    Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                                    • Login

                                    • Don't have an account? Register

                                    • Login or register to search.
                                    • First post
                                      Last post
                                    0
                                    • MySensors
                                    • OpenHardware.io
                                    • Categories
                                    • Recent
                                    • Tags
                                    • Popular