ไม่สามารถเล่นวิดีโอนี้
ขออภัยในความไม่สะดวก

#177

แชร์
ฝัง
  • เผยแพร่เมื่อ 23 ม.ค. 2020
  • Can I port the existing Arduino Nano code to a tiny ATTiny13A whilst retaining all functionality?
    www.pcbway.com First order free! 2-sided PCB just $5 for 10 pieces. Assembly for 1-20 pieces just $30.
    PCB Prototyping the easy way - see my video #129 for Hands-On details.
    Why Buy Your Printed Circuit Boards From PCBWay?
    * Prototype Fab with 24 hours Express
    * Team supported with over 50 professionals & technical
    * 99% on-Time Shipping with great support from DHL
    * Great quality approved by customers all over the world
    * Trusted Experience
    * 24 Hour Non-stop Tech Support and Production
    * Low Minimums
    * Factory Outlet PCBs with most competitive advantages
    * Chief PCB Manufacturer Located in China
    ```
    Can I squeeze the code from my current, working Fridge Door Alarm (Arduino Nano) into the miniscule ATTiny13 which has just 1024 bytes of Flash memory and 64 bytes of SRAM?
    What code compromises to I have to make? Can I use the standard Arduino syntax or do I have to drop down a level to C++? Any hardware changes? Does it provide ALL the functionality of my existing system?
    Keep watching to find out the answers to these and many other questions!
    Everything you see here PLUS MORE in my GitHub
    github.com/Ral...
    List of all my videos
    (Special thanks to Michael Kurt Vogel for compiling this)
    bit.ly/TH-camV...
    LINKS
    Everything you see here PLUS MORE in my GitHub
    github.com/Ral...
    *PCBWay Spring Festival*
    Spring Festival (Chinese New Year), the most important festival for all Chinese will be celebrated at Jan 25, 2020. We sincerely know that our hard-working and dedicated employees are the important force for PCBWay’s continuous development. Therefore,our lovely employees will have days off from Jan 19 to Jan 31, 2020 to celebrate it with family reunion.
    *TTP223 Capacitive Touch Sensor* Module 10 pieces for $2.92 inl Shipping
    www.banggood.c...
    Wowstick 1F+ 64 In 1 *Electric Screwdriver Cordless* Lithium-ion from $35
    www.banggood.c...
    *CoolTerm* (Freeware)
    freeware.the-m...
    *Capacitive Sensing Library* for Arduino
    playground.ard...
    *Lukasz Podkalicki's* excellent blog/website
    blog.podkalicki...
    *MicroCore* for aTTiny13
    github.com/MCU...
    If you like this video please give it a thumbs up, share it and if you're not already subscribed please consider doing so and joining me on my Arduinite journey
    My channel, GitHub and blog are here:
    ------------------------------------------------------------------
    / ralphbacon
    ralphbacon.blog
    github.com/Ral...
    ------------------------------------------------------------------

ความคิดเห็น • 124

  • @Chriva
    @Chriva 4 ปีที่แล้ว +4

    "Aaand welcome BACK!" Please never stop doing that. I Like the Ralph S Fury look btw

    • @RalphBacon
      @RalphBacon  4 ปีที่แล้ว

      I dare not stop doing that now! Some people call me "The Welcome Back" guy. As good a name as any, I suppose. I'm hoping the eye patch will disappear, one day.

  • @hansibull
    @hansibull 4 ปีที่แล้ว +3

    Want to save even more space? Use F() on _all_ Serial.print statements, not just "Go". And you'll also save quite alot by using delay() instead of _delay_ms(). This is because _delay_ms() is inlined, while delay() is not. MicroCore's delay() is not timer-based, but uses _delay_ms(1) inside a counting loop. This combined would save about 100 bytes of flash and 30 bytes of RAM.

    • @hansibull
      @hansibull 4 ปีที่แล้ว +1

      I'm also pretty sure you're struggling to get serial to work with other clock frequencies because the internal oscillator(s) needs calibration. Use the Serial monitor + the OscillatorCalibration sketch. Just remember to retrieve the value from EEPROM (addr. 0) in your sketch.

    • @RalphBacon
      @RalphBacon  4 ปีที่แล้ว

      @MCUDude I definitely calibrated the chip, my previous video showed me spending time doing this only to discover ATMEL had already got the best OSCCAL value. Unless I'm using a different chip here... hmm, will have to check that. Interesting about delay() va _delay_ms() in your core, at least. I shall check that out too! I forgot to go through all the Serial.Print statements and only did the first one! Doh! Perhaps I will try getting that interrupt code squeezed in after this. Thanks for the suggestions.

    • @hansibull
      @hansibull 4 ปีที่แล้ว +1

      ​@@RalphBacon Ralph Doncaster pointed out once that many of the T13 sourced from China seemed to be B-grade chips where the internal oscillator calibration value was incorrect. The T13 chip I bought ran at 9.0 MHz rather than 9.6 MHz, even though Atmel had already "calibrated" it (default OSCCAL value was WAY to low). It would be interesting to know how big of a difference it would be between the default OSCCAL value compared to the one the calibration sketch calculated for you!

    • @RalphBacon
      @RalphBacon  4 ปีที่แล้ว

      I will recalibrate mine and see whether the serial output improves at higher clock rates!

  • @AlanTwoRings
    @AlanTwoRings 4 ปีที่แล้ว +2

    So the ATtiny13 is not braindead after all. Betteridge's Law of Headlines proved once again.

    • @RalphBacon
      @RalphBacon  4 ปีที่แล้ว

      I have to admit I was impressed with it.

  • @willofirony
    @willofirony 4 ปีที่แล้ว +2

    • @RalphBacon
      @RalphBacon  4 ปีที่แล้ว

      Thank you, Michael. It was quite satisfying to get this crammed in to less than 800 bytes, with no assembler code required (other than what was being generated by some of the routines I used). In some ways I would like to take this forward with a PCB and stuff - perhaps make it dual chip capable (Tiny13/85) and maybe suitable for battery too, with Deep Sleep. I might need an ATTiny85, but I might not... Hmm, what to do?

  • @MaxintRD
    @MaxintRD 4 ปีที่แล้ว

    Congratulations! +1 for taking up the challenge and for making this very educational ATtiny13A series. I find it can be quite rewarding to cram so much functionality into a tight space. (BTW. In one of my earlier videos I showed the Ladder game on a breadboarded tiny13. It uses Charlieplexing to drive 12 blinking LEDs and it was quite satisfying to add some functionality to already tight code of this fun game).

    • @RalphBacon
      @RalphBacon  4 ปีที่แล้ว +1

      The Tiny13 definitely has a place, mostly in the commercial world, as we hobbyists can just jump to the next chip up the range without a second thought. But it was interesting to do. I am not sure whether to continue this (ie build it on a PCB and actually use it or not).

  • @Retro_Care
    @Retro_Care 4 ปีที่แล้ว +3

    I made a fridge door alarm also with a tiny13, but I kill the power on it when door is shut with a reed switch, and when opened it will start and with delays I have set the alarm modes, (4 times and after that continues alarm, similar like you did there. so why my fridge is shut the circuit is dead to save even more power

    • @RalphBacon
      @RalphBacon  4 ปีที่แล้ว +1

      An interesting take on this project. Unfortunately the reed switch I am using cannot take any power at all so it would have to drive a MOSFET. Easily done. But I don't run on batteries, so power saving is not an issue for me. But I like the idea, thanks for posting.

    • @Retro_Care
      @Retro_Care 4 ปีที่แล้ว +1

      Ralph S Bacon I made it run on a 18650 which will probably never be drained :) , and I wanted it to be small and universally used on any fridge, only thing on the board is the switch, piezo, led, and a 18640 prefab charging board (very small as well), it’s always good to see how others solve the same issue with different perspectives

  • @TheTubejunky
    @TheTubejunky 4 ปีที่แล้ว

    This was made years ago and is on instructables website.
    It was however made with attiny85 if i remember correctly.

    • @RalphBacon
      @RalphBacon  4 ปีที่แล้ว +1

      And it was made with a light detector, the very thing I don't want to use. There are doubtless 4,287+ other examples of fridge alarms out there! An ATTiny85 would be a joy to program after this tiny chip!

  • @jessicacarter8264
    @jessicacarter8264 4 ปีที่แล้ว

    Yay! Glad it worked out. I can't build any projects atm, everything is in boxes! xD

    • @RalphBacon
      @RalphBacon  4 ปีที่แล้ว

      Good luck with your move, Jess!

  • @jaybee9794
    @jaybee9794 4 ปีที่แล้ว +1

    Very interesting. You mentioned about the interrupt, what if you wired the door sensor to reset, so when you close the door, it resets. This also frees a pin, simplifies your code, and means you don't have to worry about the watchdog.

    • @McTroyd
      @McTroyd 4 ปีที่แล้ว

      Neat idea! In his current implementation, that might mean the "door close" sound doesn't play. But, if instead it plays the "door close" sound when it first starts... that just might work. Great no-code solution... just a capacitor and a pull[up|down] resistor.

    • @RalphBacon
      @RalphBacon  4 ปีที่แล้ว

      That would be an alternative idea, indeed, very good suggestion. I'm not sure I NEED that interrupt now, as I just poll the door state in the beep loop. Sorted! I shall think about the reset on door close though, neat idea.

  • @peteywheatstraw3583
    @peteywheatstraw3583 4 ปีที่แล้ว

    Has Ralph become the first known victim of The Borg?! J/K of course. Its good to see you doing better and continuing to upload. speaking of which, thanks for the upload. learned something as always.

    • @RalphBacon
      @RalphBacon  4 ปีที่แล้ว

      As you know, Petey, resistance [to my channel] is futile! And I'm glad you _assimilated_ some knowledge with this video too. Only _logical_ . (sorry for the mixed references).

  • @BigDaddy_MRI
    @BigDaddy_MRI 4 ปีที่แล้ว

    This is brilliant!!
    By the way, I’m working on a Tiny85 project we’ve talked about. A PWM signal running at 1KHz and modulated by a LDR. I want “bright display during the day, and auto dimming as the light decreases”. Seems simple, but I’m using it to dim TIL311 displays using PWM, and when it gets really dark, another pin sends a digital signal to shut off all other indicator lights and PWM dim the displays to a set (don’t go dimmer) setting. Makes it viewable are night, but not intrusive.
    So I’m in the definition state now, but the MicroDude stuff is very interesting. I’ll have to go back and watch the intro into using this code generator. Sounds ideal.
    Thanks for a great video!!! How are your eyes doing? Hope healing nicely. Take care Ralph. Love the videos.

    • @RalphBacon
      @RalphBacon  4 ปีที่แล้ว

      Glad you liked this, Harry, and your project does sound intriguing. I've found that night-time displays can be REALLY, really dim and yet still plenty bright enough to read at 2am. Commercial units rarely are dim enough and are quite intrusive with their (invariably) blue glow. Red is a better color for night-time, don't you think?

  • @bostedtap8399
    @bostedtap8399 4 ปีที่แล้ว

    Excellent project, enjoyed that one.
    Thanks for sharing.

    • @RalphBacon
      @RalphBacon  4 ปีที่แล้ว

      Glad yo liked it, a simple beginner's project but so useful!

  • @andymouse
    @andymouse 4 ปีที่แล้ว

    Nice work Ralph!...I'm using AVR library's code a lot now to, but you really had to dispense with Arduino pleasantries like digitalWrite in this one !

    • @RalphBacon
      @RalphBacon  4 ปีที่แล้ว +1

      It was an interesting exercise, Andy, although I'm tempted to go further. But that's all, right now, tempted!

  • @Ivor_Nastyboil
    @Ivor_Nastyboil 4 ปีที่แล้ว

    Interesting to see you use the Eclipse IDE. I used to really like the Arduino IDE add-in for Visual Studio, but I hated the annual subscription to use it. I tried Eclipse but never really found it as easy to use as I wanted. I have now moved over to the Programino IDE. I like how it can be set to pick up a lot of its settings from the Arduino IDE and the code colouring, prompting and auto completion facilities. I think it sits right inbetween the simplicity and minimalism of the Arduino IDE and the complexity and feature fullness of Eclipse. If you haven't tried it then it is worth a look. I purchased a license for it and with a discount voucher I found it worked out at £20. For this I can install it on as many PCs as I have.

    • @RalphBacon
      @RalphBacon  4 ปีที่แล้ว

      Indeed, annual subscriptions are really for professional users taken out of their business profits; to ask hobbyists or very small volume makers to stump up a substantial licence fee just doesn't work well at all.
      As it happens, tomorrow's video deals with this entire subject - it will be "all change" within a year I reckon, although for Eclipse users like myself, it will be "same old, same old"! Tune in tomorrow to see what you think. I'll look at Programmino but given what I just said it may be too little, too late.

    • @Ivor_Nastyboil
      @Ivor_Nastyboil 4 ปีที่แล้ว +1

      @@RalphBacon
      I shall look forward to tomorrow's video.
      The Programino web site says that the license you purchase is a one time charge and all updates are free. That's the sort of license I like :) . I want to reward a programmer's efforts by purchasing their software, but I can't afford for it to be a stupid amount.
      My favourite part of the software is that it uses your existing Arduino setup, i.e. it will pick up all the libraries you have already installed for the Arduino IDE. This means that your code is 100% compatible between the two IDEs. In fact, there is a button in Programino to open the project in Arduino.
      There are also some useful tools such as an LED character designer, RGB/LED colour selector and the ability to call up the Calculator and Character Map utilities.

  • @blic-sx9ix
    @blic-sx9ix 4 ปีที่แล้ว

    Ralph, Thanks for another great video.
    I guess PCBway has more of an advertising budget since they are not running the 5 for $2 and 10 for $5 board deals like JLCPCB is. I usually pay for faster shipping so either way the PCB cost is a fraction of the overall cost.

    • @RalphBacon
      @RalphBacon  4 ปีที่แล้ว

      Shipping is always expensive from anywhere (and I've just been hit with a £17 customs fee by DHL for stuff I've ordered from DigiKey (USA), ouch!!!) but there are cheaper option that can be relatively quick; I'll show some Real World examples in a future video.

  • @asagk
    @asagk 4 ปีที่แล้ว +2

    Nice ruler, Ralph! Do they sell it at PCBWay?

    • @RalphBacon
      @RalphBacon  4 ปีที่แล้ว +1

      I got it with one of my orders at PCBWay, a freebie. Not sure they sell it (but the Gerber files might be available, see if it is available as part of their "sharing" PCB designs in which the designer gets commision).

    • @asagk
      @asagk 4 ปีที่แล้ว

      @@RalphBacon Thank you! I'll take a look...

  • @MaxintRD
    @MaxintRD 4 ปีที่แล้ว

    Oh, I just received some of the same Logic Green SOP20 pro-mini's, so I'm looking forward to your upcoming videos. Thanks in advance!

    • @RalphBacon
      @RalphBacon  4 ปีที่แล้ว +1

      I couldn't get ICSP programming to work (I've asked expert David Buezas if he has had any luck) but programming it via the standard FTDI USB-to-Serial adapter works fine. It remains to be seen whether my project works without hitches (due to problems with this chip, I mean)! Fingers crossed.

    • @MaxintRD
      @MaxintRD 4 ปีที่แล้ว

      @@RalphBacon - That's good to know. Thanks! The part of the datasheet that describes writing flash using the E2PCTL interface went a bit above my head. Hopefully David can help. His Arduino board manager url already made it quite a bit easier to use this MCU in the Arduino IDE. Thank you both for flattening the road for those that follow...

    • @hansibull
      @hansibull 4 ปีที่แล้ว +1

      @@RalphBacon The lack of proper English datasheets and the weird ISP interface is the main reason why I haven't bothered adding LGT8F support to MiniCore. It's also very difficult to get bare chips, which makes them a not-so-good choice for production.

    • @RalphBacon
      @RalphBacon  4 ปีที่แล้ว

      @MCUDdue It's a shame these are not better supported as they are very quick and very cheap. Yes, I know, Quick Cheap, Good - pick any two! If I get stuck with mine (some "undocumented feature") I will revert to a Pro Micro or Nano or something.

  • @JerryEricsson
    @JerryEricsson 4 ปีที่แล้ว

    Strange, I just received my order for 2 pro-micro's from a China outfit. I ordered them for myself, for a Christmas Gift back on the first of November, here it is, the End of January and they arrived! The expected arrival date from the outfit was FEB 21'st I guess they know their shipping system. Took me over an hour to get my damn laptop to recognize the little guy, after fighting, with it for so long, I finally grabed an ESP32 and plugged in, found out that all 8 of the damn micro cables I tried were power ONLY with no data connections. So I now have a bag filled with power only cables, and have one lovely old heavy duty cable for use.

    • @RalphBacon
      @RalphBacon  4 ปีที่แล้ว

      I put matching, colour cable ties on each end of my USB cables and a double one for power-only ones to avoid the frustration you are describing here, Jerry! Glad you got it going. Pro Micro boards are small, powerful as an Uno, and no bootloader delay. Oh, and cheap! Not surprised you are using them.

  • @ibrag2012
    @ibrag2012 4 ปีที่แล้ว

    GL have beatiful bonus: 12 bit ADC.

    • @RalphBacon
      @RalphBacon  4 ปีที่แล้ว +1

      LGT8F328P also has 12-bit ADC.

  • @RalphDoncaster
    @RalphDoncaster 4 ปีที่แล้ว +2

    When I heard you say you can't do cap touch on the t13, I figured it would be a fun little challenge. So after a few hours of coding, I've written an example that can do it in only 40 bytes of code. Only one GPIO and no external components are required.
    github.com/nerdralph/nerdralph/blob/master/avr/touch.c
    I'll probably explain it later in a blog post, but for now you should be able to figure it out from the comments in the code.

    • @RalphBacon
      @RalphBacon  4 ปีที่แล้ว

      Gosh, I never realised all the interest that this Tiny13 project would generate! I shall be very happy to look at your guru code. 40 bytes? Absolutely amazing. Thanks so much for this, Ralph.

  • @flemmingchristiansen2462
    @flemmingchristiansen2462 4 ปีที่แล้ว

    Neat little project.
    I was thinking (yeah that do happen) if you take out every Serial print, would you have room enough to do the interrupt?
    When running/finished, you dont need debugging and no serial port, would you get a pin more to utilize?
    The white box on your fritch seems rather big, is it big enough to house the chip and switch, you need the PCB, you can solder your connections directly on the chip.
    As i remember, the piezo speaker can be cut to shape, just need a little, without lowering the performens significantly or find a decent box that the chief will accept.
    You could build the whole thing into the top panel, over the door, I dont think that there is much under that cover, no ugly box, no wire clutter and you might even have room for a small power supply.

    • @RalphBacon
      @RalphBacon  4 ปีที่แล้ว

      Wow! You really are thinking this project through, Flemming! As it happens I'm not sure I NEED the interrupt any more. I just added a further door state poll between beeps and it all works as expected. The fridge box is tiny, only 1cm wide and maybe 6cm long (just enough for the reed switch and touch pad). A slightly larger box would be required to house the entire project but it could be done, thus letting me solder the touch switch directly onto the pCB as you suggest. I like the idea. We shall see whether I take this forward. Did you get the PCB kit yet?

    • @flemmingchristiansen2462
      @flemmingchristiansen2462 4 ปีที่แล้ว +1

      @@RalphBaconI forgot to type a word or two, after programming, you dont really need the PCB, if you dare, you can solder directly on the chip.
      I haven't received anything lately, I be checking the mailbox.

  • @jyvben1520
    @jyvben1520 4 ปีที่แล้ว +1

    Pavlov's dog, now Bacon's cat, need a second touch wire to just call the cat without opening the fridge door.
    i need to check the bottom of the door, can i put a pressure switch there out of sight ?
    Has Ralph got a blue passport yet ? for visiting his mum in EU ...

    • @RalphBacon
      @RalphBacon  4 ปีที่แล้ว

      The last thing I need is to call the cat, he's there as soon as he hears that door opening sound! A pressure mat would work too. No blue passport, I'm sure I will be let in to see my mum and family, regardless. But now you got me thinking...

  • @MUHAMMADYAWARIFRAHEEM
    @MUHAMMADYAWARIFRAHEEM 4 ปีที่แล้ว

    Very informative video

    • @RalphBacon
      @RalphBacon  4 ปีที่แล้ว

      Thanks, Muhammad, glad you liked it.

  • @orbitalair2103
    @orbitalair2103 4 ปีที่แล้ว +1

    Link for the little tiny to breadboard pcb ? Thanks. Beautiful cat Ralph !

    • @RalphBacon
      @RalphBacon  4 ปีที่แล้ว +2

      In my GitHub now, Gerber files plus EasyEDA project. Thanks for the nudge.

    • @orbitalair2103
      @orbitalair2103 4 ปีที่แล้ว

      @@RalphBacon thanks, I need to learn the EasyEDA (hint for a video, how to edit someone elses design you imported into easyeda). I have use JLCPCB a few times with other gerbers, top quality.

  • @johngodden5196
    @johngodden5196 4 ปีที่แล้ว

    Great little project and as some of the comments below say getting rid of the debug print may give you enough for the extra code. I am thinking of some other uses this can be put to, one is for the roller and back doors of my workshop, always forgetting to shut them.
    Sorry to be critical Ralph but I would like to see more of the project on the screen and not your boof head. Whilst it is nice to see who is presenting the video placing you your "bust" in the position you have it is offputting. Perhaps a smaller inset right in a corner would be more appropriate.

    • @RalphBacon
      @RalphBacon  4 ปีที่แล้ว

      "My boof head", as you put it, John, has been increasing in size (not in real life, just on screen) and I agree, I must shrink that down. Thanks for the nudge. If you read some comments I made below I don't think I even need the interrupt now, I've sorted out that beep that continues when it should not. Glad it got you thinking about other doors that need shutting!

  • @jongeorge412
    @jongeorge412 4 ปีที่แล้ว

    Hi Ralph
    Great video - thanks (reminds me of many, many years ago writing assembly code for DEC PDP8s with only 2048 total mem)
    Looking forward to next video - Could you include some use/explanation of difference between PWM pins and the single DAC pin (DA0/PD4) shown as available in spec. sheet for the 8F328P ? (Have tried and failed spectacularly to get this function to work !!)
    From DataSheet - "An 8-bit programmable DAC that can be used to generate a reference voltage source"
    Thanks again.

    • @RalphBacon
      @RalphBacon  4 ปีที่แล้ว

      Thanks, Jon. Regarding the DAC/PWM have you read the GitHub from David Buezas as he is the expert in these chips? github.com/dbuezas/lgt8fx

  • @Mr.Leeroy
    @Mr.Leeroy 4 ปีที่แล้ว

    22:15 you should not need a hardware interrupt for detecting events that in 99,9% of occasions take longer than half of MCU's clock cycles. something is very wrong in the code..
    Instead of doing a whole lot nested loops, maybe check all flags in a main loop sequentially.
    Instead of using delays, use timestamps to make your main loop as fast as possible.
    Not sure if these techniques will solve your issue (haven't had the time to read your code closely), but these are the things that I noticed at a glance.

    • @RalphBacon
      @RalphBacon  4 ปีที่แล้ว

      "...something is very wrong in the code."
      Not sure I follow your logic here, Leeroy. I just don't want to continually poll the "door close" routine but would rather have a (volatile) variable change its value when the door state changes. It's what has been running on my Nano version for years. Interrupts are there to be used, surely?
      I coded this not as a state machine (which seems what you are suggesting), as I was following what I did before and was pretty simple. (My HomeAlone project was a state machine project because it was huge.) This project follows the Jackson Structure Programming style where we "POSIT" a state but then "ADMIT" an alternative state. It's how my life as a professional developer started, all those years ago!

  • @bipolarchemist
    @bipolarchemist 4 ปีที่แล้ว

    Nice job on cramming almost an exact replica on the nano code onto the ATTiny13, and as you say, I am sure that with a bit of work you could probably get everything to work on this chip as it does on the does on the nano. It is definitely worth considering for some badges, I'd think, that mostly just flip pins high or low to blink LEDs, but then, is the cost (in your time to optimize the code to fit a smaller footprint) enough to offset the price of moving to the 85? Especially if you were doing it at a much larger scale? I know they have their uses, but I think I'll stick to my ARM based CPUs with their(sometimes) ridiculous amounts of flash.

    • @RalphBacon
      @RalphBacon  4 ปีที่แล้ว

      This was definitely an academic exercise, to see whether the ATTiny13 was a viable chip or just a curiosity. The ATtiny85 would be a better choice just in terms of breathing space! But flashing a few LEDs on a badge is what the Tiny13 could do with its eye shut. Lots to think about still, thanks for posting.

  • @reelrebellion7486
    @reelrebellion7486 4 ปีที่แล้ว

    I'm not sure I read it correctly, but when you showed the size in arduino side the 796 bytes was in parents next to the 814. A clue to the difference? Or wishful thinking on my part?

    • @RalphBacon
      @RalphBacon  4 ปีที่แล้ว

      I've fired up the Arduino code again and it says...
      Sketch uses 814 bytes (79%) of program storage space. Maximum is 1024 bytes.
      Global variables use 30 bytes (46%) of dynamic memory, leaving 34 bytes for local variables.
      The Eclipse version says (after changing all _delay_ms to delay):
      C:/sloeber-workspace/ATTiny13_Fridge_Alarm/Release/ATTiny13_Fridge_Alarm.elf :
      section size addr
      .text 752 0
      .data 28 8388704
      .bss 2 8388732
      I will try getting that interrupt code in!

    • @reelrebellion7486
      @reelrebellion7486 4 ปีที่แล้ว

      @@RalphBacon sorry to waste your time. I suspect I saw the 79% and my brain substituted 796.

  • @pintokitkat
    @pintokitkat 4 ปีที่แล้ว

    Would putting a door status call in between each individual beep spoil the beep sequence while the door remained open? Could it provide the beep delay at line 186?

    • @RalphBacon
      @RalphBacon  4 ปีที่แล้ว

      Already done that, Andy! Several viewers have mentioned the same thing, and the odd thing is that I already did it on one loop but not the other! My brain! I'm seriously thinking about getting this running on battery power next, using the reed switch and my auto switch-on circuit, then a nice PCB...etc.

    • @codya.4704
      @codya.4704 4 ปีที่แล้ว

      @@RalphBacon I would love to see a video on that as well, if you proceed with the project. It would be interesting to consider power savings as well as code efficiency, battery management, heck, maybe even a small solar panel would be cool to throw in to the mix.

  • @sted9245
    @sted9245 4 ปีที่แล้ว

    Could you not check the status of the door in the buzzer loop and jump out of that routine back to the main routine to get around shutting the door mid beep cycle?

    • @blic-sx9ix
      @blic-sx9ix 4 ปีที่แล้ว +1

      Looks like he did just that in the GitHub code.

    • @RalphBacon
      @RalphBacon  4 ปีที่แล้ว

      Yes, I've sorted all that now without an interrupt in sight! If it works, it works! And it does. Do I actually take this forward with a PCB and stuff or not, that is the question!?

    • @sted9245
      @sted9245 4 ปีที่แล้ว +1

      @@RalphBacon glad you got it sorted!

  • @aziubin
    @aziubin 3 ปีที่แล้ว

    The reason of the hang over months might be internal time counter, which overflows, need to check is it 32 bit or more in MicroCore implementation.

    • @RalphBacon
      @RalphBacon  3 ปีที่แล้ว +2

      If the internal counter overflows (Timer 0, millis) after 49 days, Alexander, it just overflows (and goes back to zero) but should not affect the module at all. I suspect it is electrical interference and one day I will investigate and fix it!

  • @borayurt66
    @borayurt66 4 ปีที่แล้ว

    It seems all the electronics/Arduino related channels I follow are sponsored by either PCBWay, or JLCPCB. I had PCB's made by both of them, I could not see any difference in quality and delivery times, but there was a slight price difference in favor of JLCPBC in boards smaller than 10cm x 10cm. So, is there any particular reason for you to choose PCBWay?

    • @RalphBacon
      @RalphBacon  4 ปีที่แล้ว +1

      It would be unprofessional of me to comment on any of my PCB and component sponsors in a comparison test. Each has their definite strengths. PCBWay, for example, can offer PCB assembly using both SMD and THT components on both sides of the board. They will accept your own components, accept just some of the components from you and source the remainder, or source them all. Their boards are second to none in terms of quality, such as through hole plating, silk-screening and drill accuracy. To get the other side of the story, you will have to repeat that question in a video sponsored by another PCB maker! I'm sure understand my position.

    • @borayurt66
      @borayurt66 4 ปีที่แล้ว +1

      @@RalphBacon Well, this was actually more than I was hoping for. I will ask this question to the creators of the other youtube channels that are sponsored by either of these companies. I honestly think there is no difference between these two companies (qualitywise), they both serve the hobbiests like me well. Whenever I need a PCB made, I get quotes from them both. I am glad they both exist, both of them provide a better quality and price compared to the local manufacturers in my country as "prototype" quantities (ie 5-10 PCB's) go. Thank you for your honest answer Ralph, I am glad you exist too! :-)

    • @RalphBacon
      @RalphBacon  4 ปีที่แล้ว +1

      You know I'm sponsored by both the companies you mentioned, right?

    • @borayurt66
      @borayurt66 4 ปีที่แล้ว +1

      @@RalphBacon Now I do. 😄

  • @Hasitier
    @Hasitier 4 ปีที่แล้ว

    What’s that flashing battery full display in the background at the end of the video Ralph?

    • @RalphBacon
      @RalphBacon  4 ปีที่แล้ว

      I wondered if anyone would spot that, MIchael! I recorded my next "project idea" using it, but found that this video was already far too long so I snipped it. That project is a beginner's project too but I might even use a Rotary Encoder with it... I'm still umming and ahhing over that one (and waiting on something from Banggood to arrive).

    • @Hasitier
      @Hasitier 4 ปีที่แล้ว

      Ralph S Bacon some of your viewers have eagle eyes (btw I watched the video on an iPhone so no big screen) but the flashy thing caught my attention. I do like long videos. So no Problem for me. I never used a rotary encoder but it should be easy. Maybe we see it in a future video.
      I also received your package a few days ago. Now I need to get myself some components to solder it.

    • @RalphBacon
      @RalphBacon  4 ปีที่แล้ว

      It's easy to put together, Michael, SMD or THT, just get 1206 SMD size where you can as the pads are designed for that, but 0805 will fit too.

    • @Hasitier
      @Hasitier 4 ปีที่แล้ว +1

      Ralph S Bacon since I do soldering (which is since almost 30 years now) I never used smd much. But your kit will be an easy beginners kit. I will order a few smd example books with resistors and capacitors and try it out.

  • @gavinsmalley1513
    @gavinsmalley1513 4 ปีที่แล้ว

    So glad you got it to work! It is truly astonishing what can fit in 1024 bytes of compiled code.
    I'm guessing though that if it were a commercial product they would be using one of those $0.03 One Time Programmable micro controllers that @EEVBlog reviewed last year.
    Funny you should mention your home alone project, I was talking about that just yesterday with someone as an example of the sort of situation I wrote the library github.com/yknivag/ESP_OTA_GitHub for.

    • @RalphBacon
      @RalphBacon  4 ปีที่แล้ว

      Yes, I'm more impressed with the Tiny13 (and MCUDude's MicroCore) than I thought I ever would be! I'm not sure I would ever have the courage to update my mum's HomeAlone units with an OTA update. I mean, if it went wrong then what? An expensive trip to Stuttgart, that's what! But it's something I'd like to experiment with so thanks for the link, I shall read that later.

  • @sameerk12982
    @sameerk12982 4 ปีที่แล้ว

    Hello Sir.... What happened to your eye? Hope nothing to worried about

    • @RalphBacon
      @RalphBacon  4 ปีที่แล้ว

      You need to read my blog to find out the gory details!

  • @thepvporg
    @thepvporg 4 ปีที่แล้ว

    Have you thought about detecting current draw of your fridge to determine if an event happened like the fridge door opening compared to the fridge compressor.
    One thing that could provide some kind of passive and hidden detection, alarm and all housed in one box of tricks to do the job with no intrusion other than a possibility of adapting the fridge body so that it becomes the touch sensor that you check for a double tap so that single events can be regarded as false triggers.
    The doors should be isolated, the designs are often all similar, some metal bracket and pin in to a retaining hole that is moulded in to the plastic sub-frame of the door and the metal outer is just a wrap around form that is back filled with insulation foam.
    So touching the door should not produce any triggering, then again, it depends on who made your fridge.
    This could be a box that can hide behind the fridge or be designed to hide on top of the fridge as a disguised object for easy access.
    The idea came to me as it reminded me of a project I am waiting to build and it uses current detection to allow a cell to connect to a bus when its fully charged, the amount of current draw is very small, so if the lights are LED then it should detect if you were to utilise such a detector. All you'd need is to discriminate and reject large spike events and take it as a signal that the door could be also open as compressors can come on faster when the door has been open a minute, mine comes on 2 to 3 times an hours, when I open the door, it comes on after 30 seconds.
    As I don't know what fridge you have got or its design, its hard to say but a suggestion that you could try in the future as a major upgrade by going passive. You could also possibly use that to record door events and compressor runs and look at them in a spread sheet to see if your fridge displays any predictable behaviour that could be programmed for as secondary backup checking, like if the door has been opened and the compressor came on 3 minutes ago and the door is still open, may be a super loud blast of noise.
    Fastest way to fridge and freezer compressor failure is extended run times as they are not designed to be run constantly.

    • @RalphBacon
      @RalphBacon  4 ปีที่แล้ว

      I must admit I wanted to keep it simple, Mark. Using the entire fridge as a touch plate seems unlikely to be very stable. I wish I could build this into a new fridge whilst it was still in the factory, so I could hide all the parts.

  • @BerndFelsche
    @BerndFelsche 4 ปีที่แล้ว

    Definitely a pass ... Get rid of the serial and you will have space for elegant interrupt handling.

    • @RalphBacon
      @RalphBacon  4 ปีที่แล้ว +1

      The interrupt is definitely more "elegant", Bernd, than continually polling the door state, but it works OK! What I would prefer to do is get this working on battery power with the reed switch activating the power and my auto switch-on circuit letting it run until the door closes again. Could be an interesting slant to an otherwise very simple project? Then get a PCB, a nice project box... this could run and run!

    • @flemmingchristiansen2462
      @flemmingchristiansen2462 4 ปีที่แล้ว

      @@RalphBacon wouldn't you have to push the silence button before opening the door?

    • @RalphBacon
      @RalphBacon  4 ปีที่แล้ว

      You would, Flemming, and I have sorted that out too. Amazing what a brain can come up with when it is pushed!

  • @mahlapropyzm9180
    @mahlapropyzm9180 4 ปีที่แล้ว

    What makes it hang?
    Overflowed a variable?

    • @RalphBacon
      @RalphBacon  4 ปีที่แล้ว

      Unlikely, Mahla. Every few months. Not code-based, I am sure. Probably a power glitch or something like that. But the WDT should sort that out.

    • @mahlapropyzm9180
      @mahlapropyzm9180 4 ปีที่แล้ว

      @@RalphBacon My one experience of programming a microcontroller (many years ago) had a problem with the system clock overflowing every ~46 days due to the size limitation of the internal time variable.
      (or somesuch).

    • @RalphBacon
      @RalphBacon  4 ปีที่แล้ว

      Oh yes, the *millis counter* does "overflow" although it is better expressed as "wraps around", that is starts from zero again. Every 49 days or so. Doesn't affect anything though.

    • @mahlapropyzm9180
      @mahlapropyzm9180 4 ปีที่แล้ว +1

      @@RalphBacon OK, the microcontroller I used (or its runtime executive) was clearly not so sophisticated.

  • @JC-zl7sq
    @JC-zl7sq 4 ปีที่แล้ว

    Sorry I think it's a fail. A user would not except the device continuing to beep after the door has closed, Will your Wife? ;-) I think I will stick with the 85. I will add the watchdog reset into my sensors as sometimes they need resetting.

    • @RalphBacon
      @RalphBacon  4 ปีที่แล้ว

      Actually, JC, just adding in a door state poll in-between beeps sorts that out. Which I already did in one of the loops, can't understand why I didn't do that in both places! Perhaps I don't even need the interrupt any more?!? Is this now a PASS?

    • @JC-zl7sq
      @JC-zl7sq 4 ปีที่แล้ว +1

      @@RalphBacon Ok it's a PASS now.

  • @superdau
    @superdau 4 ปีที่แล้ว

    For a terminal program with really cool features (cooler then coolterm ;) ) check out hterm ( www.der-hammer.info/pages/terminal.html ). It's been my goto terminal program for over a decade. I find it especially useful for microcontroller development, because you can input and display characters in hex, decimal or binary as well. It's also nice that it can insert newlines on display after a certain number of bytes or time. Helps alot, when the data you get are some binary stuff without newlines.

    • @sanguchito7381
      @sanguchito7381 4 ปีที่แล้ว

      Second, HTerm is the s@*t!

    • @RalphBacon
      @RalphBacon  4 ปีที่แล้ว

      @superdau Sounds interesting, I shall investigate, thanks for the heads up.

  • @jayherde0
    @jayherde0 4 ปีที่แล้ว

    TL:DR ... If you continually increment a counter, you'll eventually over run it.

    • @RalphBacon
      @RalphBacon  4 ปีที่แล้ว

      If you continually decrement a value it will under/overflow but no bad things happen. A single unsigned byte with a value of 0 which is decremented goes to 254. No harm done except the program may misbehave, of course. I'm sorry you found this too long, but I'm sure Arduinite beginners may get some ideas.

  • @henrikjensen3278
    @henrikjensen3278 4 ปีที่แล้ว

    The Tiny13 is brain dead, I would only bother for projects with 1million or more devices.
    I am pretty sure I could implement you fridge alarm include touch switch in it, but it would be in assembler (I do not really want to spend the time, it is many years ago I was fluent in AVR assembler).
    Of course it would be without any serial support, that is a waste of space (And I am impressed you got space for it).
    Using an extra chip for touch is only for low volume production, i.e. a ATtiny 85 would have been perfectly valid and a better solution.
    I wonder why interrupt takes up a lot of space, when doing assembler it do not necessary do it, but then using a interrupt for a slow input is often a waste of coding.

    • @RalphBacon
      @RalphBacon  4 ปีที่แล้ว +1

      Why does everyone keep talking about assembler in an Arduino channel? I think I have proven that the ATTiny13 has a place in the world although the ATTiny85 would be a better choice were I to actually implement this project to replace my Nano, although as it has no more pins than the Tiny13 I still could not use the Capacitive touch sensor (it requires two pins). But I will try and get that interrupt code in again, I think.

    • @AlanTwoRings
      @AlanTwoRings 4 ปีที่แล้ว

      Micro has SRAM (eg. ATtiny13) = not braindead
      Micro has no SRAM (eg. ATtiny11, 12, 15, 28) = braindead

    • @henrikjensen3278
      @henrikjensen3278 4 ปีที่แล้ว

      A micro needs considerable more than a few bytes of SRAM to not be braindead.
      What was a very simple microprocessor many years ago, it is a braindead microprocessor today. If you need to make something very cheap and low power it maybe worth checking it, but you need very high production numbers before it is cost effective,
      For hobby usage it might be nice for a power switch, but doing much more is a waste of time. Get a better processor. The only reason to use it, I see, is as a challenge!