#174

แชร์
ฝัง
  • เผยแพร่เมื่อ 13 ก.ค. 2024
  • Too small to program? Or just brain dead?
    $8 off your first order at LCSC Electronics with lcsc.com/?href=ralphsbacon&so...
    More information (including all links, sketches & PDFs in my GitHub):
    github.com/RalphBacon/174-ATT...
    So I was persuaded by my viewers to try teh ATTiny13 chip on the basis that it was very cheap and was "just a miniature Tiny85".
    Well, having spent a couple of days getting the Oscillation Calibration (OSCCAL) value only to find that ATMEL had already done this for me I then wondered why my serial output was not all it should have been.
    I followed Nerd Ralph (Ralph Doncaster) and MCUDude (Hans) in their quest to remove the bloat from the Serial library. Watch the video to find out what they managed to do!
    List of all my videos
    (Special thanks to Michael Kurt Vogel for compiling this)
    bit.ly/TH-camVideoList-RalphB...
    More information (including all links, sketches & PDFs in my GitHub):
    github.com/RalphBacon/174-ATT...
    INFORMATION LINKS
    MCUDude's MICROCORE
    github.com/MCUdude/MicroCore
    Put "Serial" on a diet, says Ralph Doncaster. What's MCUDude's response?
    github.com/MCUdude/MicroCore/...
    Using External Interrupts for tinyAVR Devices
    PLEASE NOTE: EXTERNAL INTERRUPT IS ON PIN 6 PB1 (not PIN 7 PB2 LIKE THE ATTINY85)
    ww1.microchip.com/downloads/en...
    An ATTiny SoftwareSerial Library
    github.com/lpodkalicki/attiny...
    ATtiny13 - software UART (debug logger)
    blog.podkalicki.com/attiny13-...
    100+ Projects on ATtiny13
    blog.podkalicki.com/100-proje...
    ATTiny13 DataSheet
    ww1.microchip.com/downloads/en...
    PRODUCT LINKS
    10pcs ATTiny13 SMD 2019 NEW MODEL ATTINY13A $2.43 + 70c shipping
    s.click.aliexpress.com/e/B2JxZy8s
    5pcs/lot Through Hole DI{P version ATTINY13A-PU $2.70 + 86c shipping
    s.click.aliexpress.com/e/464iihs4
    White Paint Pen, 6 Pack 0.7mm Acrylic White Permanent Marker White
    amzn.to/2FaeuZ9
    ATtiny13 Development Board - if I buy this I'll let you all know
    www.banggood.com/ATtiny13-Dev...
    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/RalphBacon
    -----------------------------------------------------------------
  • วิทยาศาสตร์และเทคโนโลยี

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

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

    Happy New Year Ralph, hope the eyes will heal well.

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

      Thanks, Steve, let's hope so!

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

    I love the attiny13. Never had problems with it. I don't recall putting a serial output on it though.

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

      Same here: Never used serial output in attiny series or arduino libraries. If I needed something for debug I have used dw.
      Edit: Also you avoid using any strings in that flash size. Recommend to use binary synchronous transmissions like i2c or spi.

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

      The ATTiny13 is fine for what it is. It's just my attempt at programming it using techniques best suited for the UNO (or possibly the 85) that is causing issues.

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

      @@RalphBacon pushing the boundaries is what led to great discoveries

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

    I use the attiny13 for my Christmas Tree shaped PCB which has 12 charlieplexed LEDs and it was a major challenge fitting multiple modes on it!
    I use it because it was big enough to fit some nice animations on it, it does very well on a coin cell and also it's cheap! It's about 11p delivered from Ali and even locally from farnell its only 35p or so.
    If you are interested in a kit I could send one on?
    Code for it is here if anyone is interested:
    github.com/witnessmenow/PCB3

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

      That would be great for next Christmas, Brian. Are you selling them (commercially)?

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

      @@RalphBacon depends on your definition of commercially! I do sell them on my tindie store: www.tindie.com/products/brianlough/christmas-3-pcb/
      If you want one just message me on tindie and I'd be happy to send one over as a way of supporting the channel. Absolutely 0 expectation for a video or anything like that, it would be your to do what you like with (include leave it sitting in a drawer 😅)

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

      We've both missed the board for this Xmas and if you send me one now who knows where it will be in December! Nudge me in October 2020 and I might take you up on your kind offer. I got some similar things from my sponsor this year too but yours has intelligence.

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

    You youngsters honestly 😁 😂 😁
    In my days as a lad, I only had 256 bytes of memory full stop and had to do a pulse counter, division and a LED display for the chemical engineering department to win a grant. No compiler - 6800 hand assembler was the ONLY way.
    Love this chip though, I got a 85 after you talked about them so I’m tempted to try one this small for the fun of it.
    Great start to year - thank you for your hard work.

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

      Yeah, they wouldn't be able to eat a boiled egg without consulting a smartphone. ... For small, simple programs the human brain is the debugging tool, Watson! Adding bit-bang serial to a chip without built in UART interferes with timing and can make the code more difficult to debug, if it's time sensitive. A debugging aid for a fridge door timer?? He's pulling my leg!

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

      my first micro SCMP chip 256 bytes of ram (Sinclair MK14) and that included the video ram. always good to see your memory changing on screen as the program runs!

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

      256 bytes? Luxury! in my day we had a single byte to contain all the code and run time memory! Luxury! And we had to share that byte with 21 other people! Luxury (If you don't know Monty Python, watch this 3 min video, but it starts at my keyword: th-cam.com/video/VKHFZBUTA4k/w-d-xo.html)

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

      ​@@RalphBaconcardboard box! you were lucky. brought up on Monty Python. It's sad that Neil Innes past away on 29th Dec such great music. it least the jokes will be remembered, Circuit Python, Micro Python, and Monty Python the mother of them all.

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

      @@RalphBacon I can only answer:
      A whole byte - on wet days we had to share a nibble :-)
      Love the reference to MP though - you win! Though technically that link is not the final MP team with TBT and MF in it (but who cares - it shows the young whipper snappers what life was really like)

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

    Happy New year Ralph. Happy to see my Attinyshield works with Attiny13 as well as 85 :)

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

      Happy New Year, Themis! I did wonder if there was something that was going to stop it working with a Tiny13 but it worked just fine, Your programming board is getting a lot of exposure, I hope you are getting good sales! It's a very nice board (and not just this one, your entire set). It certainly saved my Bacon! Ha Ha!

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

      @@RalphBacon I have only tried it with attiny85 but its nice to know it has more capabilities. Of course the credit goes to you who keeps experimenting with the Attiny's. They are my favorite videos on your channel and not only because i keep seeing my ATtinyshield in the front (which i like very much). My best to you and your family.

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

    Happy New Year Ralph,
    You probably may want to replace line 24 of your BasicSerial.cpp with this line:
    char buf[n / base + 1]; // Assumes 8-bit chars plus zero byte.
    This line will calculate the number of characters required to display number "n", according to the "base" parameter.
    I don't know what your original code line does, but I guess the line above will do what you intention was in the first place.
    Regards,
    Thomas

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

      Some update to my proposal, because there is still some overflow happening after some time (test 300++)
      Instead of creating the buffer dynamically, I recommend to use a fixed buffer size. The original declaration reserved 32+1 byte for number string which is more than half RAM resulting in overflows after a few test runs. If you restrict the buffer to 10+1 it's sufficient to show show the number in decimal and hex. So try using char buf[11];
      Regards,
      Thomas

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

      I shall _definitely_ try this out, thanks for the correction.

  • @olavl8827
    @olavl8827 3 ปีที่แล้ว +5

    Just remember this is not an Arduino. This chip really likes to be programmed in assembly language, and it doesn't care much about communicating with anyone or it would have implemented some sort of hardware serial interface to begin with. So it's not for those applications. It's happiest in applications where it can be built into something and you forget it's even in there. It will do any standalone job of taking an input or two and driving an output or two, year after year, without ever failing or complaining.

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

      Well, it's surprising how much compiled C++ you can get into an ATTiny13 if you put some effort into it. My Tiny13 Fridge Door alarm fits and works well. Much more effort than using a Nano, obviously but cheap enough that fridge manufacturers could include a Tiny13 alarm for a few cents!

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

      @@RalphBacon When I realised my project fitted into a 13 over an 85 I got so giddy. Then went on an absolute tirade of optimisation. I use the Arduino IDE myself, but microcore makes it very easy to get tiny code if you're scared of assembler. Just need another Arduino like an Uno or something to actually flash the chip and you're golden.
      A nice trick is using spare registers for features you aren't using as variables, my code uses no RAM at all now: gist.github.com/mpentler/b74f4829248a855a7f5eb1be1b50a420
      1.bp.blogspot.com/-z30GYvFJ6Rk/XxAvcG_fSGI/AAAAAAAAAvE/2x2byoAcicMFv12OBnA9gI9ajGXSrxABwCLcBGAsYHQ/s320/badgePCB.jpg

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

    Thanks Ralph. I appreciate your suffering and realize what a time impact it is to track down these issues.

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

      Your empathy is most appreciated, Dale! Yes, it's a challenge alright but still quite enjoyable. Early days yet.

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

    Well, hello from June 2023.
    Video person from the start of 2020, I hope you've enjoyed the first two months of the year, since it might tumble a bit from here 🙂

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

      Let's hope not, at least it's warming up (in the UK, at least).

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

    Happy New year Ralph, Glad you are well and back to confuse me more for 2020 :-)

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

      The confusion is all mine! Happy New Year!

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

    Nice video. A 33 byte long buffer on the stack for conversion of a number seems very optimistic to me. (char buf[8 * sizeof(long) + 1];) Better only print numbers in hex, no buffer needed.

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

      Hex works just great, no problem! But maybe I don't need to print that many numbers anyway. I'll see what I come up with.

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

    I will look into why your code doesn't print properly. Not sure why you didn't just use the standard Serial.print implementation, It's almost as light-weight as the BasicSerial library.
    The ATtiny13 is very limited, and you can't use "regular" Arduino tricks like adding print statements all over the place. Even though the Arduino wrapper is very lightweight, you still limited by the flash and RAM. You'll also have to place all strings inside F(), to prevent it from using lots of RAM. Try the latest release! It ain't that bad!
    BTW, Ralph Doncaster and I did provide a pretty neat OSCCAL sketch that uses the serial communication to tune the internal oscillator(s). You should try this too!

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

      I've just had notification that the MicroCore has been updated, Hans, so I'll take the new version and try out the standard Serial (although I couldn't get it to work last week, no idea why). The OSCAL sketch I used was a bit different to yours, it just changed the value step by step until the output became readable (as you perhaps saw in my video) and the middle value was the one to take. But I shall try yours too. Great to hear from you, thanks for posting.

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

    I can think of a lot of fun stuff that could be done with one of these but I'd NEVER use arduino for it. Plain assembler, baby :D

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

      yeah or plain C if you don't want to suffer as much... Atmel Studio 7, Atmel ICE as SPI programmer and even without a bootloader, you're good to go.

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

      @@jordanwaeles That too would work. I'm just kinda anti ardu on these small devices. It's wasting too much space :)

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

      @@Chriva I'm with you on this :)

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

      If you dig down below the Arduino-specific 'wrappers' there is plain old C++ underneath - which might be all we need.

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

    Love the pre Covid enthusiasm at the start

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

      Oh dear, only at the start! Oh well, this was made a long time ago so maybe I had overdosed on my morning coffee!

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

    The ATTiny13A has analog, and I built a plant-water-o-meter of sorts, reading analog from a probe, and lighting either a green or red LED, all powered by a coin battery and switched with a tilt switch, my girls were most excited with it and it has been in use for 2+ years! But yeah, very limited compared to the 85 whilst price is very similar....

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

      That's the nub of the matter. PRICE! Not necessarily for us hobbyists but on a commercial scale 50c difference in price is a huge thing. When you are selling millions, anyway! Your project sounds very good for the Tiny13 and goes to show you can build useful stuff with it.

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

    Always enjoy your videos. Hope your eye heals quickly. Happy New Year sir. Say Hey to Benny for me.

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

      Benny says "Meow!" back at you, Joe. He's in our bad books right now, having managed to cover himself with cat poo at 11pm last night so this morning we're cleaning the entire house. That aside, he has given me some tips about the ATtiny13 so we shall see if he has redeemed himself in the near future!

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

    BasicSerial is actually my asm code too, just an older version (slightly less optimized). To program chips like the t13 with minimal overhead, use the Atmell AVR toolchain command line tools. A basic blink sketch takes 66 bytes on a t13, or about half that if omit the interrupt vector table.
    github.com/nerdralph/nerdralph/blob/master/avr/blink.c
    For debugging the t13, I like to use debugWire, though there is not an easy way to do that (right now) for people who want something simple like the Arduino IDE.
    Another technique I use is to log to the eeprom and then use the programmer (a USBasp in my case) to dump the eeprom. I then use tools on the host computer to display the log data, or can write a small C program to do things like print the data in decimal form.

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

      BasicSerial seems great to me, Ralph, it's "my" PrintNumber that was behaving a bit oddly but I've had several suggestions as to what is going wrong, including a comment (or six!) from Hans, which I will read in detail later. I'll look at that link most certainly, thanks for the heads up.

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

    Ralph, Thank you.
    I'm one of the diminishing returns people. I do get the code optimization challenge part of the project. And have great respect for the programmers of yester year.
    Smaller is good to a point, and there does come a point where as a hobbyist, with limited time to play, I'd rather have a project working, then spend hours just to get a micro controller working to run the project. If the one chip up will do the job, and I have it, that is the one I use.

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

      Which is why my Fridge Door Alarm is currently running on an Arduino Nano - plenty of memory and it "just works" (apart from when it seems to hang, every few weeks or so, but the WDT should sort that out). But it will be interesting to see how far I get, right?

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

    Very informative video sir

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

      Glad you liked it Muhammad!

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

    Great video. I've always found the low-level stuff fascinating. First thing I'd try is making buf[] static to see if it's stack corruption that's tripping things up. You wouldn't want to spend the RAM that way normally, but it might point you in the right direction to fix the underlying problem.
    As for the fridge, how about putting a couple of coasters under it to lift the front a little, and a big jar of pickles in the door to give it a bit of a gravity/momentum assist ;)

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

      I'll try this and many other suggestions, thanks for chipping in, good to hear from you.

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

    Hi Ralph, looking fit mate, great video.
    Did you try a slower baud rate, like 9600?
    This could be a good low component count LM555.

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

      The baud rate is fixed at 115200 or 57600 for the two speeds - lower speeds are not supported, Tom. So it's not corruption it's the code. Hang on, are you suggesting using a 555 timer? For what? And don't say a Fridge Door Alarm!

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

    A Happy New Year to you, my Friend .. and to all your viewers !!
    I think I'll let you goo the coding challenge for this device, Ralph. Hahaha !! Maybe in 2023, I'll be up for the challenge, but for the time being .. Naaaah! I'll stick to the '85 .. at most. Hahaha!
    Great video and great referencing from those two « Gurus » your references points to. I don't know these guys, but I'll sure peek an eye in the new year.
    Until then, my Friend, have a great day and good health ! Chat with you soon ..

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

      I think the Tiny85 is growing on my after my use of the Tiny13! As Einstein said "Make it as simple as possible but no simpler". I think the Tiny13 breaks that rule!!!

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

    Excellent! Another great video Ralph.
    My opinion(probably not worth even 2 cents)--the printNumber function is too general for the restricted resources of the chip. I would try making it very specific. Instead of allocating buf size sufficient for any base (33 bytes for a 4 byte unsigned long displayed in base 2), I would make a function to print specifically base 10 and limited to the expected range of n. Then I would add a line of code to deal with the case of n being outside the expected range. Making the size of buf much smaller and maybe preventing overflow.

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

      Yes, it's a bit generic and that buffer is causing problems so I shall look at that too, along with the suggestions from both MCUDude and Nerd Ralph.

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

    13a advantage over the 25/45/85 is availability in wider termperature range.
    I programmed the little blighter in "raw" C.

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

      And it would seem, Berndt, that the more we program these little blighters in raw C, the better is likes it, space wise. Luckily we can do that from within the Arduino IDE or Eclipse. No need for a setup{} or loop{}, either just a main().

  • @crazyg74
    @crazyg74 5 หลายเดือนก่อน

    I love this! Doing it just for 'the sport' rather than the necessity. 🙂

    • @RalphBacon
      @RalphBacon  5 หลายเดือนก่อน

      Well, brain hurting sport, for sure! But an interesting exercise nonetheless.

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

    Happy new year. I joined the B-log but couldn't see a benefit - hey-ho - may I ask a question here? Firstly, I started learning C a long long time ago in a different galaxy. I have just started, in retirement, to mess with Pi & Arduino. I picked up on one particular comment by you which gave me a clue that Arduino 'C' is different/supplemented from "standard C++"? As an example I looked up 'pinMode' in my 'O'Reilly Practical C++ Programming by Steve Oualline 1997 edition' but there is no reference to it, so I figured that Arduino had added something to C. Would you care to do an explanatory video on this? Thanks

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

      The benefit of my blog, Richard, is that I only post occasionally so you're not inundated with TL;DR articles! It just gives me another outlet to rant on about things. Thanks for subbing to it.
      About Arduino and "standard" C++, that's quite interesting you mention that because when I "reveal all" about how far I got (or didn't) with my Tiny13 Fridge Door Alarm I will be talking about that in more detail.
      If Arduino had not done what they did and wrap all the intricacies of C++ with their "friendly" functions (eg pinMode), I really don't think Arduino would have taken off in the way it did. Either that or we would all be expert C++ coders by now!!! More in a future video! Stay tuned! Now, if you sub to this channel you should get notified of my videos as I publish them.

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

    Hi Ralph, what development environment are you using here? It’s obviously not the Arduino IDE, it looks like eclipse?

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

      Yes, it's Eclipse Sloeber from Jan Baeyens. But he has given up development so I'm waiting for the Arduino new, improved version also based on Eclipse, coming out this year (at least in beta form, it's in alpha now).
      eclipse.baeyens.it/
      github.com/arduino/arduino-pro-ide/releases

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

    For me, July 2023....
    I have a very simple ATtiny85 project. Only a few lines of code and have just ordered an ATtiny13A, basically because they're ridiculously cheap, and if I can save a few pennies then I'm all up for that 😂

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

      They most certainly have a use in the microcontroller world.

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

    I do not see much reason to use these very limited microcontrollers anymore and if I really have to use them I prefer to program in assembler.
    I once did a dimmer in a ATtiny15 (500 words program memory, 64 bytes ram), it was controlled with a serial communication and had to synchronize the trigger output to mains (As all dimmers has to do).
    With your serial output it looks like your buffer have problems, do you have any interrupts using the same memory? It do not look like baudrate problems.

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

      Yes, it's the buffer, as I suspected and as others have mentioned an suggested changes. But the challenge in using this tiny chip is getting it to do more than print a number, I want a Real World product! Fridge Door Alarm is coming along nicely. Well, no, it's a PITA but it's a challenge!

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

    "TH-cam, this is the best video I've every seen." There you go Ralph, just for you as requested.
    No, all kidding aside, that was a good video. You put way more work into it then I would have done and I love the idea of the tiny series. Just put an extra Dollar, Pound, Euro whatever, in the Sunday Collection Plate for being wasteful. Then put on an 85, and never look back. lol.

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

      I know what you mean: why am I torturing myself with this limited chip when a Tiny85 does it all without much trouble. I'll think of an answer and let you know! Oh, thanks for letting TH-cam know (I don't suppose they read the comments but you never know).

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

    Ralph firstly many thanks for hours of education and entertainment , you sure beat the BBC :-)
    May I suggest ( as others have said) that there may be an issue with the Tiny Shield causing your printing issues. I have tried your code with an Attiny13a on a breadboard and seen 100,000+ lines without error, Boring i know :-). I have also used "Nerd Ralph's" serial drivers in various guises with great success ( I even ported it to a PIC)
    Any way please keep the good stuff coming and look after that eye.

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

      Wow! I'll consider you my semi-official beta tester! that's good news. Others have suggested various changes so I might try those and/or just unplug the thing from the programmer as you suggest!
      Does this mean I get a cut of the BBC licence fee? I thought not!

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

    Maybe it is time to consider learning AVR Assembler programming? ;-)
    Happy New Year, Ralph.

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

      I'm considered it right now, Nick. I'm mulling it over. Nope, I did that for the PIC and look where it got me. In Arduino-land!

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

      @@RalphBacon AVR isn't as hideous as PIC assembler, being similar to Z80 assembler which is where I learned the art.

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

    That's why in older video I mentioned 14pin Attiny84 and not tiny44 or any of the 8pin tinys.
    There is a reasonable limit in cost reduction that we should aim for making low batch PCBs. Diminishing returns rule is too strong here. Often by saving a bit of money we spend a lot more time on the project than it is worth.
    I can justify using 328p in any amateur project if it is a Chinese pro mini clone ($1.5) and not an original arduino. Time is worth more.

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

      Yes, Leeroy, and it was comments like yours that made me look at alternatives. I haven't stopped looking and the ATTiny84 may be one of the contenders. But, you say "diminishing returns" - it's all a challenge so stay tuned and see how far I get!

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

    thanks Ralph with you and Gadget Reboot both doing ATTiny videos i had to go and buy some 13's and 85's to start having a look at boot loader free programming. so feb will be ATTINY month, as i expect Aliexpress will take that long. :(

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

      You need to read Lukasz' web:
      blog.podkalicki.com/100-projects-on-attiny13/ it's really good.

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

      Try Futurlec.com out of thailand, faster than alidistress.

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

      A pity they are not properly set up to use PayPal.

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

    Happy new year, Ralph! I ended up getting 10 of the ATTiny13A-PU chips last night, about 4 or 5 hours before you uploaded this video... I thought it wouldn't be too difficult, but now I'm not too sure xD Though I did get 10 for £4.72 for delivery within about a week (I actually only intended to get 5 for ~£2.50 but while comparing prices I forgot to take one lot out... whoops!)
    I think adding a dedicated controller to my projects for power (like the ones you've done recently) would be a good idea, and the ATTiny13A would be perfect for such small tasks and would only increase my component cost by $0.90 (from LCSC) and it's customisable unlike that dedicated chip. I'll join you in that challenge trying to make the On/Off/Kill circuit on there!
    Oh, and now unfortunately I have to say that I've let the magic smoke out of (in this case) a Nano. Blew one up last night accidentally bridging 5V to ground trying to debug why my interrupt kept triggering more than once, even though I'm using FALLING in my code, it will interrupt, then when I release the button it will interrupt again. Not sure what I'm doing wrong

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

      Two words come to mind - contact bounce!

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

      @@SpeccyMan Who is this mysterious bounce person? ;) All jokes aside, would this just be some check against millis for when it's triggered, since I've used Ralph's 10ms check for debouncing (also tried increasing it to 100ms though not much luck). I was also trying to write a toggle that if it'd been triggered then it should not trigger the interrupt again.. although if you hold the switch down it freezes the program since it keeps interrupting... argh!

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

      On no! You let the magic smoke out, Jess! That's unfortunate, but at least a replacement is only the price of a cup of coffee. Have I said that before? Yes, you need to use FALLING if you only want it to register the switch once but contact bounce code is also required, I've found. 10mS usually more than enough.
      As you have more than enough Tiny13s, have a look at Lukasz' web page:
      blog.podkalicki.com/100-projects-on-attiny13/

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

    have you thought of moving away from arduino and maybe give MC Xlab a try, pickit4 can program them. happy new year Ralph

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

      Well, I usually program using the Eclipse IDE and revert to the Arduino IDE for demos but maybe I do need a replacement as the Eclipse version I'm using is on borrowed time.

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

    Happy new year sir

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

      And to you, Yogesh, I hope you are keeping well.

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

    I now use the $1 8-pin SOIC STM32G031J6 instead of ATTiny(s) which is just a lot pleasant to work with due to more memory, extra built-in peripherals and raw power. In my opinion, the only place where it won't replace an ATTiny is when you have to power it directly using 5V (though I/O are 5V tolerant).

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

      And this is the problem (for me, possibly others, too), Arnaud. We have so many capable microcontrollers so which one(s) do we choose - and why? For non-professionals we have to wait for a suitable "core" to become available otherwise it's pure C++ which is a lot of work. Once a "core" is developed then everyone can have a go. I will look at that chip to see why you like it so much. The datasheet is already open in my browser! Thanks for posting.

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

      @@RalphBacon Whilst I like to keep a minimalistic approach, I just feels like there are no more reasons to spend time in optimization for one-off projects. With recent market changes, these AVRs certainly sit in a strange position between 0.05$ chinese chips and Cortex-M chips starting at less than 1$. Thanks to stm32duino, the STM32G0 recently got Arduino support but I did not try the STM32G031J6 on it and this variant is brand new. I will try it and report back.

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

      I used a STM32F030F4P6 (TSSOP20) for a project and it is also pretty cheap, which is also has support for STM32Duino, it didn't back them, so I used STM32CubeMX. But there is also a few new competitors using UPDI programming, like the ATtiny3216, also inexpensive. Bitluni's lab made a video about it 2 months ago.

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

    when using low level chips, don't use a high level language. if it has a uart write to it yourself. if you don't send txt you dont need all those overheads.

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

      So I'm beginning to realise, there is just not enough space for much at all!

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

      @@RalphBacon these chips are a bit like the early PICs which were designed as Peripheral interface components which is why they were called PIC's so i told years ago. they are good to replace a 555 or a simple keyboard to serial data but maybe not RS232 etc. a few bits for the RX to lock on to for timing then just short high period for a '0' and long one for a '1'. bugger you got me thinking about things again.

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

    Now we waited all year for you to get back, for what -no funny glasses? not even a decent pirate eyepatch?
    Well well fun aside.
    Happy new year to you and my best wishes for your eye to get better soon.
    Very interesting topic today, one way to save memory could be righting in machine code or assembler code, im not sure if that can be embedded in the compiler.
    If you really need saving memory then you probably have to do some hard core programming and not use shortcuts as C++++++++++++

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

      I'm so sorry you are disappointed, Flemming, but I thought that everybody would be bored if I continued that theme. Perhaps we will have a quick reprise when my cataract is done?

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

    I'm sympathetic to the idea of climbing this particular mountain (as you've said elsewhere) for the sake of climbing it. An educational expedition is rarely wasted in the long term. That said, if this particular experiment doesn't pan out, perhaps this chip could still be used as programmable glue logic? Last I looked, the ATTiny13* is cheaper new than any PAL/GAL ("programmable array logic"/"gate array logic") chip I've seen, and doesn't require any special hardware or software to program it. Off the top of my head, I could see something like this ATTiny being used to deal with timing-sensitive applications (like the WS2812 "NeoPixel" LEDs). The ATTiny can deal with the asynchronous conversions to the timed data stream for a larger MCU or full-sized computer. (Edited for clarity.)

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

      Yes, the Tiny13 could be put to all sorts of (simple) uses, and controlling Neopixels is a great idea. But I'm still climbing that mountain and I've discovered a nice cafe along the way (ie I've had a modicum of success!).

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

      @@RalphBacon Awesome! Looking forward to hearing about it. :D

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

    (groan) Have been through all of this ... even the various cores. Hopefully I was not one of those encouraging you to DEVELOP on a tiny13. That is insane. Among my projects are an RGB light animator and a 5-wire speed-adjustable stepper controller. Both use ULN2x03 Darlingtons. The thing to do is get your code right on another AVR MCU, like the tiny85, then winnow it down to where it is really small, and compiles for the tiny13 with AVR-GCC. The pros probably use that hog of an application, Atmel Studio, with DebugWire(tm), and lots of assembly.
    Different subject: This LGT8F core finally merged menu-selectable 32mhz clocks, intern or extern. Your name comes up a lot! You must have a claim to fame that I am unaware. Professor or something? github.com/dbuezas/lgt8fx

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

      I agree esp. with "That is insane" no reason to work with that amount of memory these days

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

      "The pros probably use that hog of an application, Atmel Studio, with DebugWire(tm), and lots of assembly." - did you read all the comments here, that's what they seem to do!
      You are right, my name does seem to come up a lot but then again I've quite a few videos covering a wide range of products!

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

    I noticed that the correct count on a lot of that messed up output was the last few digits. It looks like something is jumping on your serial output. Instead of using arduino print statement you could write to the hardware registers of the serial port save space.

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

      Possibly, Joey. There is a lot I might be able to do but I've already found that as long as SAFE_MODE is not switched on, then using digitalWrite is just as efficient as manipulating the port directly. We shall see.

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

    I've got 2 ATTiny13's.
    Actually bought in error as I was looking at 45's at the time and only realised once they arrived.
    I've not used them yet as Ibassumed they were useless for all but the most basic of things. Like switch on an led at a certain light level or temperature.
    I've got an ATTiny45 running as an I2c to serial converter to allow a YX5300 mp3 module to communicate over i2c instead of using its native serial comms.
    But I think that would be out of reach of an ATTiny13.

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

      Indeed, Jason, I2C might be a byte too far! But it can still be made to do other stuff:
      blog.podkalicki.com/100-projects-on-attiny13/

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

    "....and eventually you can get some white stuff"
    Yeah, that happens when I shake mine too vigorously also.

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

      It can also cause blindness too... oh! But my eyes are getting better, honest!

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

    UART not supposed to work reliably without a crystal oscillator, 85 works and 13 doesn't mean much

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

      Chips like the Tiny85 and Tiny13 which don't have UARTs can be bit-banged to emulate one, but it all depends on the clock speed as that determines the baud rate that can be successfully generated without errors.

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

    Happy new year Ralph, I have a fine project for you that could be perfect for the ATiny13. Using it as a I2C sensor interface. Reading an analog sensor, do some calculations, and have another micro reading the "converted" values from the ATTiny. In particular i was thinking could I use an ATTiny to read and do all the RMS calculations from the ACS7xx family of current sensors, and the ZMPT101B AS voltage sensor and use it as an I2C slave, offloading the readings from the "main" microcontroller so that this can concentrate on other stuff, like handling the UI via html or whatever else it need to do. Maybe someone reading this who also have the necessary knowledge could jump in and collaborate ?

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

      Collaborate how?

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

      @@KillerDragon987 Hi Enzey, well I guess it is quite a few ways to do this, if someone has an idea on how to get started, maybe this person could kick it off by using GitHub ? The problem for me is that I dont have the faintest idea on how to start this kind of project, as my knowledge about this quite limited or else I would have done it my self..

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

      I'm having trouble just getting it to do an interrupt without running out of memory so I don't know what software I2C would do toit.

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

    Thanks Ralph. Sharpie has one of the white markers in the usa

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

      That's interesting, Mark, I never saw a white Sharpie on Amazon, I'll check but it might be a Stateside item only.

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

      Ralph S Bacon Sharpie AD969, Medium Point, White Ink, Oilased Paint Marker, Pack of 3 www.amazon.com/dp/B00KGCOZ9Y/ref=cm_sw_r_cp_api_i_pkkeEbS8X757E
      Sharpie Permanent Paint Marker, Fine Point, White (6 PACK) www.amazon.com/dp/B07KTDW5J5/ref=cm_sw_r_cp_api_i_5dleEbQWMTTMH

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

    Happy new year Ralph, my early days of programming ‘C’ and Pascal we used to insert Assembler code to speed up execution critical time functions. So I wondered if we could do the same in the Arduino environment, to replace function calls. I did a small bit of research and came across this article on how to insert assembler code, this might help to reduce the code size etc. ucexperiment.wordpress.com/2016/04/02/arduino-inline-assembly-tutorial-12-functions/ cheers Keith

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

      That's a nicely laid-out and explained article, Keith, thanks for the link.

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

    It's all about the most efficient chip for the application. There are times when I see someone lock up a nano or wemos D1 mini in a project box using only a couple pins and a tiny bit of code and it makes me cringe. (Deep breath)

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

      Quite so. But an ATTiny85 often works but runs out of pins too quickly. Maybe I should look at the ATTiny84 next, as it has everything the Tiny85 has but with more pins (and a 16-bit timer). I wonder how cheap, though...?

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

    From one paramecium to another, this is where the Arduino ecosystem sews you into a bag, and tosses you into the river...all the reliance on 'cores' and other people's libraries to build 'sketches' just to retain the illusion that we're actually coding for an embedded processor is nonsense.
    I don't think Arduino is intended to do anything useful, other than teach fundamental concepts, and, for that, you pay a price in *object code* inefficiency.
    BTW, hope your peepers recover soon. You actually have the glint of rudimentary intelligence in the one remaining uncovered, and if you keep investigating this problem, I have no doubt that you'll evolve from paramecium to rotifer in no time.
    Happy New Year.

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

      Happy New Year. Some clever people (MCUDUde, Nerd Ralph) have managed to come up with a very *efficient* core for the Tiny13 (and several other chips) thus obviating the need for the rest of us to reinvent the wheel. Let's see what I can manage regarding the Fridge Door Alarm before passing judgement too soon. I'm not sure I am ready to evolve into a rotifer yet, I haven't (yet) invented the equivalent of the Tiny13 wheel.

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

      @@RalphBacon I'll be watching with worms on my tongue (baited breath)...cheers.

  • @dataexpunged-1627
    @dataexpunged-1627 4 ปีที่แล้ว +2

    If you are using assembly, i guess 1k is quite a lot actually. I've using it to make a bridge between an analog sensor to i2c

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

      Well, yes, assembly is _cheating_ though! As it happens the code fits really well now. amazing what fits with a bit of care and outside help!

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

      Not using ASM is like "Tying both your shoe strings together and seeing how fast you can run"

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

    I don't bother with serial on tinies, and even then tiny 45 is the cheapest one I used with 4K flash and 256bites of RAM... There's just not enough memory on any of the dumber chips for me, and the price difference doesn't justify dealing with any less memory options.

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

      Yes, the smaller chips are a bit of a challenge. But sometimes employers demand use of the absolute cheapest chip available so it's useful to explore what they can do, now and again!

    • @bob-ny6kn
      @bob-ny6kn 2 ปีที่แล้ว

      What do you code that requires larger that attiny memory?

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

    If you just want to test the logic of the sketch, might I suggest that you first work it out on an Arduino UNO then remove the debug code and compile it onto the AT Tiny. The IDE may provide compile symbols to indicate the target chip. If that is the case, you can put the debug code into #ifdef blocks that are only compiled when targeting the ATMega. Otherwise you can always define your own symbol and turn it on/off in any manner convenient.

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

      Believe me, Michael, that sounds great in theory, but as I've discovered a single statement on the Tiny13 can generate several hundred bytes of code. And not all functions are available on the Tiny13. And the Wiring.h is all wrong for the Tiny13 if you use the UNO version. Frankly, it's quicker to build directly on the Tiny13. But the #if#else#endif compiler directives is always a good idea and I use that a lot just to shut the Serial.print statements off in my (non-Tiny13) code for production running. Good ideas, thanks for posting.

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

    Devices like these are best programmed in assembly language. The overhead in calling functions and using local variables and function arguments is easily overlooked.
    For debugging on limited systems like this you can't beat using a LED to reflect the state of debug tests in your code.
    I'd say that the ATTiny13A is one of those processors not suited for programming in C. In fact, I'd prefer to use a low end PIC micro programmed in assembly language or JALv2 before using one of these.

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

      No doubt assembly language would work well, Neil, but as my viewers are (mostly) from an Arduino background it's still useful to see how far I can get using Arduino-speak (or, at least, the code it wraps). And serial output for debugging is _so_ much better than LED indicators - _if_ you can get the Serial to work well enough!

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

      I usually just use C with the FCC compiler without the arduino ide. That is good enough. No need to go to assembly. For debugging I usually use a pin to blink a pattern for error or success codes... I give up on serial output. The resources are just to limited for that.

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

      They (MCUDude and Nerd Ralph) did a good job in their Serial in the MicroCore, I've got to say, Very lightweight. But then it depends on what we're sending out. A couple of strings and all the memory has gone anyway!

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

    I think the smallest I will go is the 85 or the 14, but my current project is the SAMD11D14AM. Digikey has more than a few selling for US$0.69(I believe) which just seems too good to be true. Most of the fun of the SAMD21, but you are limited to 4k SRAM and 16k Flash. An interesting chip, for sure. Can't wait to see your solution for programming 8 pin DIP processors.

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

      "...you are limited to 4k SRAM and 16k Flash." - er, sorry, did you say *limited* to that amount?!!?! That's even more SRAM than the 328P, albeit with half the Flash. Think of the poor ATTiny13 with 1024 bytes Flash and 64 bytes of SRAM. No comparison! Limited indeed!

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

      Well, compared to the SAMD21, the SRAM and Flash can feel a bit limited, but nowhere near as limited as the 'brain dead' ATTiny13. And with a 4k bootloader, that 16k flash is reduced to 12k which is pretty tight with the blink sketch taking up 9416 of 12288 bytes.

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

    recently found out by accident that arduino's random() function takes half the flash space of the tiny13
    i needed to read a analog pin, make up a 19 byte table with bytes changing based on the analogread value and calculate its checksum, then send it out every 1/4 second at 2400 baud. random was for debugging but i forgot it to comment it out.

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

      You sure it wasn't the serial out that was hogging the resources?

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

      yes, by removing the random function my code went from 99% of flash space to like 52%. i dont use a softserial lib, i went full digitalwrite and delay for just sending bytes.
      the purpose of it is immitating a electric bike battery so the bike thinks a genuine battery is attached, coding this on a 328p was easy, it allows mistakes and being lazy.
      a tiny13 is a different story. the project is called yamaha battery dongle, mainly on a german ebike forums.

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

    “It’s like writing with typewriter correcting fluid ....” .... hmm, I wonder how many youngsters will know those joys? Happy New Year!

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

      So as we don't use "typewriters" as such any more, why do they continue to sell this stuff that eventually goes hard in the bottle? Good point you mention there.

  • @Thingstest-rl8xu
    @Thingstest-rl8xu 4 ปีที่แล้ว

    Try test code using on a breadboard without anything connected beside FDDI chip. Is likely rare but possible program shield or uno is causing problem with the 13 chip. Maybe chip can't handle Two commands sending data out next to each other for whatever reason. Try a very small delay say 10 to 100ms between output string and number.

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

      All good suggestions but I think the problem has been identified as the code I'm using, which I will try to correct later today.

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

    Sorry I was thinking of the Flash size yes all variants have 64, try the 22?

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

      Oh, the Tiny22 is much more like the Tiny85 in terms of memory. But this could go on an on! After the Tiny13 project I will look for something a bit more beefy!

  • @yurkshirelad
    @yurkshirelad 2 ปีที่แล้ว +1

    Have you tried Atmel Studio?

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

      Briefly, Mike. I got the Blink sketch working!
      But at the same time I found Eclipse and that was better (and more focussed towards the Arduino). But now I use PlatformIO (Visual Studio) for all my personal projects, but switch to Arduino IDE 2.0 (also Eclipse based, but well hidden) for my demos.
      I'm sure Atmel Studio is excellent but it is going to be a steep-ish learning curve. I would check out a few videos on YT first to see if it is going to give you what you (eventually) get and want.

    • @readingmcinfo7573
      @readingmcinfo7573 2 ปีที่แล้ว

      @@RalphBacon Hi Ralph
      I tried to use Eclipse on a Windows platform and I could not get it to would not fly, I created a virtual Unix box and got it to fly but could not get it to talk to the USB serial ports to program the devices.
      In the end I settled on using Studio - but the import an Arduino sketch wizard was really flaky. I need to use a 'grown up IDE' as I am dyslexic and Arduino IDE is just all black and white jumble. I need to use Studio just to help write code - I love the colour stuff and the predictive coding stuff and how it knows the register names etc (not to mention variable redefinition and moving chunks of code about (refactoring or some such) - I could not write code without this support.
      I tried Arduino IDE2.0 but it is so flaky by comparison.
      My main gripe with Studio is inability to import Arduino libraries such eg SendOnlySoftwareSerial and the RadioHead ASK code - what I now do (thanks to another of your posts) is conditionally compile code - I write in Studio - then copy code in chunks into Arduino IDE and do a last minute compile using Arduino and build as 'Arduino as ISP'.
      There's got to be a better way - using a Pololu ISP with Studio is seamless but there's no Arduino library support. With ATtiny13A not such as issue as these use so much space anyway but it would be nice to be able to C++ code ATtiny85 without Arduino IDE but still be able to use specific Arduino libraries.
      I did try to import some Arduino libraries manually into Studio once but this was like jumping down the rabbit hole (Alice in Wonderland).
      If you have any advice on how to get Eclipse to work on a Windows platform, I'd be keen to hear it - I'd like to find and 'end to end' description of how to do it.
      BTW - I made a fairly functional gadget geocache using just an ATtinty13A (Pollaris) - I don't think they are brain dead but I used a 'scope on a toggling pin for debug. My next gadget geocache has a collection of ATtiny85 an ATtiny13A working together on specific tasks - some to manage battery charge via solar, one to control a motor and one to manage RF input. Divide and conquer.
      But time moves on - I want to develop applications using UPDI and ATtiny402 - do you have any advice on these? - programmers seem to be 'build you own' - I'm looking for some integrated solution like the Pololu ISP with Studio. But in the words of Bono from U2 - 'I still haven't found what I'm looking for'.
      Love your posts.

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

    I know this is old but, at least one solution to programming this or almost any microcontroller is to get a MiniPro TL866A so you can use the ICSP lines to program the microcontroller. I have one and I checked the software and found it has the ATTINY13 series in its list.
    EDIT: I don't know about the Atmel MCUs but the PICs have the calibration saved as part of a "Load A and Return" instruction in the last location in program memory. Any program can CALL the last location in program memory and on return, the calbration byte will have been loaded into the A register so it can be written to OSCCAL.
    EDIT2: Off-hand, I'd guess that you'd get a lot more "milage" out of something as small as the 13 by switching to assembly language instead of compiled C code. No high-level language will ever manage to economise memory usage the way writing directly in assembly code can.

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

      No need for a MiniPro to program the ATTiny series, Melkior, we can do it with the Arduino's ICSP connector (running a special upload sketch). I use the ICSP for all my "production" projects to avoid the delay on switch-on with the bootloader.
      ATMEL MCUs do have a calibration byte set, and I did show in one of my videos how I was trying to tune the chip (probably a Tiny13). Only to find out it was already highly tuned!
      Assembly is a whole different kettle of fish. Modern C compilers can give any average hand-crafted assembler program a run for its money. As it happens, the code for my fridge alarm has been reduced to just a few hundred bytes thanks to "Nerd Ralph" aka Ralph Doncaster. Just shows what can be done with some tight C++ coding! thanks for your comments, good to hear from you.

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

    Ralph: With respect to the “corrupted” serial output.....can you load the same code on another microcontroller that has more resources and see if the output is still “corrupted”? If yes, this would eliminate possible limited memory issues with the AtTiny 13.

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

      It was the buffer that was too small, Bruce. Once I had increased that it worked just fine!

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

    The internal R/C oscillator in that chip is not worth a darn. Slow the baud all the way down then step up one at a time till you get errors. Back it off one level. Then to be sure, warm the chip and cool the chip to be sure the r/c constant does not change enough to still effect the serial output. Serial works no clock line so can only be off so much before it loses it's mind. lol. What sucks is that you can put external oscillator on it but it takes up pins on the thing.

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

      Yes, that's always going to be the issue with internal oscillators, John. They are probably "good enough" for most things but serial comms is, as you say, particularly prone to corruption by a wayward clock. This chip *will* take an external clock on a single pin (pin 2) but that means no easy crystal fix - and anyway, with so few pins it's just another obstacle. The application has to fit the chip (or vice versa), I guess.

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

      the RC-oscillators drift and jitter is generally good enough for UART-purposes... But you have to make sure that the desired baudrate is possible due to integer division limitations.
      I have not looked at the actual code, but it might just be that there is some inconsistency with the requirements of the 115200 bit/s or 8.68 µs/bit and the clock frequency of the ATtiny 4.8 MHz or 0.208 µs, 1,2 MHz or 0.833 µs and 9.6 MHz or .0104 µs.
      It could also be the fact that the .S assembler code possibly uses registers for the serial transmit which the GCC-compiler uses for other stuff during the number conversion....

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

    Ralph, in your printNumber function, you are declaring char as a local variable. AVR compiler may do different things, this may be on the stack, or register. Since it runs right for a while, I would bet its on the stack. Change to a global and see what happens. Also check the function call depth.

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

      I'll try this and many other great suggestions, I'm sure I'll get it working eventually! Thanks for posting.

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

    For the same price you can use the ATTiny402 with built-in UART. Amtel Studio/ MPLAB is a better coding option for these devices with limited resources.

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

      And this core supports it nicely: github.com/SpenceKonde/megaTinyCore

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

    I don't know what the problem is for sure but with such limited memory you can have the heap and stack colliding depending of interrupts and how the context change is handled.
    Maybe a way to improve the situation would be to make your own print function with only the capabilities you actually need. Also unsigned long? Do you really need that? Each byte of memory counts...
    You know that the 1st digit of a byte converted to decimal is b/100 the second is (b/10)%10 and the last is b%100 ... Coding that is pretty easy and probably more compact.

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

      The 'unsigned long' method is what Arduino did for the UNO. Everything is converted to that, eventually. But not the best approach, agreed. I will have to reconsider.

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

    can't you use the attiny13a I think that has 1k of ram?? and is cheap and same footprint

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

      Mine is a Tiny13A, Fred - same memory as all Attiny13 variants but supports picoPower and works off a wider voltage and temperature range. Yes, cheap to buy, but at what cost?

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

    Actually that small sketch at the end took 23 bytes from the SRAM, not just 14. The remaining 9 bytes were in the .bss chunk which contains uninitialized variables.

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

      I missed those, Jukka, which means it uses more memory than I thought. Oh well, I will have to trim the code back to bare basics.

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

    I think flash programming should be available through debugwire. Not sure if you need to use avr studio or mplab. xpresso and curious nano boards may have compatible programmers. At least PICKit4 or ATMEL-ICE (PCB) will work as programmer. Debugger with these small chips are gold.

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

      looking at adding a pickit4 to my other pickit 2,3 just to add debugwire to the mix. have to use a serial output to debug is a pain in the butt. so use to using the hardware break point on even the smallest pic's.

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

      Also like new attiny. only programming inteface is that UDPI. Seems like next version of debugwire. so only one pin for programming device. They also added "glue logic" with 2x 3bit lookup tables. Also planning to order pickit4. I have pickit2+3, avr dragon and some others. I have debugger for all chips that I have. Also MSP-EXP430G2ET is nice toy. Ti did new version that works with usb3 controllers.

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

      Sounds like I need to look up "DebugWire" and get a replacement for my PicKit2 then. Funnily enough it was the latter that put me off PICs several years ago. I could no longer program the newer PICs with the PICKit2 and needed a PICKit3 (before the clones were available). At the time I had no money for that so I was stopped in my tracks. Hello Arduino!

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

    I have do bad news on one of your links Ralph. I tried to go to your list of files that you and Mr. Vogel worked so hard on with my phone. It wouldn't open it with the mobile version and the desktop version wouldn't come into focus so I could read it. Usually all I have to do is wait a few seconds and the focus will readjust for a small screen but not this time. It just stayed foggy and unreadable.

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

      The file is a pdf file, Steven, so there is nothing funny going on. This is the direct link, try this (I just did and it works fine):
      www.dropbox.com/home/1.%20TH-cam/TH-cam%20Video%20List?preview=Ralph+S+Bacon+TH-cam+Videos.pdf

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

    Happy new year! Alas, July 2023, not June.

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

      Close enough! Happy New Year 🎊🎈🥳🎉anyway.

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

    despite the downsides, still a nice little chip

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

      I've nothing against the ATTiny13. In fact, since my Fridge Door Alarm project I've gained respect as to what we can use this for.

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

      *crisp

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

    Ralph further the Attiny13 stuff suggest you change
    char buf[8 * sizeof(long) + 1] to char buf[11]
    as the maximum length of string of ascii characters required for a 32 bit long is 11 ( 10 + one null)
    , the original was allocating 33 bytes which I guess was close to the stack/ram limit of the tiny 13..
    BTW. the REAL "brain dead" tiny avrs are the tiny 4-10 as they only have 32 bytes of ram 512/1024 flash and only 16 of the registers !

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

      Great! I'll see if I can code my entire HomeAlone project into an ATtiny10 then. Or perhaps not! The Attiny13 Fridge Door Alarm is challenge enough (but coming along much better than I'd hoped).
      Thanks for the code suggestion, I will be checking all these out later this week.

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

    You may not have noticed but one of "Test" terms was corrupted also. See at 4:46.

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

      I missed that! But Hans (MCUDUDE) has commented with some pointers for me to try teh MicroCore Serial method of outputting stuff, so maybe my problems will soon be over!

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

    I'm a cheapass but if I'm building a one off project I dont care to spend a buck or two for a chip that wont be a hassle to work with. most likely it'll get recycled into something else one day anyways.

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

      I'm interpreting that to say you'd prefer to spend (a little) more on, say, an ATTiny85 or even a 328P, rather than have problems like the one I'm facing with the ATTiny13? I suspect you are not alone, Scott. But this is a mountain to be climbed and I'm in the foothills, where The Only Way Is Up (apologies to Yazz).

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

    Hi Ralph great video, I agree with 64 bytes memory, its hard to thinks of what you could get done esp using arduino IDE lets see what people come up with (sounds like a competition brewing). But there is a need for a low cost no frills uC for small jobs that works with Arduino code. I am currently looking at the STM8 range (STM8S103F3P6) they are about 40 cents each and break out boards start at a dollar. This is the JSON to use with IDE raw.githubusercontent.com/tenbaht/sduino/master/package_sduino_stm8_index.json (use STLINK)
    They give you 1k Memory and 8k flash with 20 pins and include I2C/SPI/USART etc. Have ordered some will see how they go for simple stuff

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

      It's a challenge certainly, Andrew. I tried to build my Fridge Door alarm and have had to simplify the functionality somewhat just to get it to fit. But it's a work in progress and we will see how far I get. The SMT8S103F3P6 sounds interesting and cheap... once again you have piqued my interest. 1K SRAM and 8K Flash sounds like manner from heaven after this latest 'challenge'! Let me know you get on via email! Good to hear from you.

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

      Have a look at the STM32G031J6 if you are willing to spend a dollar.

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

      Not a _whole_ dollar, surely?

  • @SeanChYT
    @SeanChYT ปีที่แล้ว

    If your coding abilities are such that you are dependent on using libraries and "cores" for every little task, then simply know your limitations and use a bigger chip. It's not the chip that is brain dead in this case. It was designed to be exactly the way it is.

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

      Ouch! Harsh words! But a grain of truth inasmuch that libraries are rarely written with limited space in mind, so they will certainly take too much. A bigger chip can always be the answer for us hobbyists, but not for commercial applications, where the hardware decision has already been made, and 5 million are on order!

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

    You could consider using TinyDebugKnockBang. That way you can get your debug messages through the USB connection same way as with an UNO. You dont need a USB/serial adaptor.
    I once made a blog about communication with the tiny's
    ernstc.dk/arduino/tinycom.html

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

      That looks very interesting, Erni, I shall read it later, already open in my browser. Thanks for the link.

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

    I don't understand why u don't use the delay function in the arduino library, it's already build in

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

      Built in, it may be Dave, but it uses a few more bytes. I'm using the function that delay calls directly.

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

      @@RalphBacon i understand, thx. Why do you load the arduino library if u don't uses any arduino functions(is it consumes memory?)?

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

      @@davy822 Because he's using the setup and loop functions, which are Arduino constructs. Plus there will still be other initialization stuff needed.

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

      I'm not using Setup and Loop, actually, just a main(). But only the bits of the Arduino library that I use will be compiled so I'm keeping it down to a minimum.

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

    Why not do led feedback instead of serial : a red and green led, maybe use pwm if possible

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

      you can also bit bang a single output to show the state on a scope, also good for checking timings etc.

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

      All good suggestions. But as I come form the MS world of dotNet I'm more used to single-stepping code with some decent debugging tools. Maybe I need to downsize a bit. (A lot).

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

    Hi Ralph, another fantastic video as always. I do hope your sight improves soon.
    The ATTiny13 is most definitely a very able chip given the appropriate knowledge.
    Not my projects but two that have really stood out for me using it are:
    github.com/witnessmenow/PCB3 & hackaday.io/project/25944-kitt-knight-rider-badgebrooch (the former being loosely based on the latter).
    Much can be done in such a small chip. Many blinky lights too with Charlieplexing.

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

      This chip surprised me, Gavin, I must admit. I'll talk about it more in a future video, regarding the (self-imposed) Fridge Door Alarm challenge!
      Moving from the Tiny13 to the Tiny85 was like being released from prison (well, not that I know, but I'm assuming). Freedom! So much Flash memory. 512b of SRAM! Amazing!
      The absolute downside to both these chips is the limited number of pins. You just run out so quickly (LED charlieplexing not withstanding).
      My current project is using the LGT8F328P Mini-EVB board, at a whopping 70p - very capable and many more GPIO pins but whether it remains ATMega328P compatible in my project remains to be seen. If not, then back to a genuine Pro Micro!
      Good to hear from you Gavin, thanks for posting.

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

      @@RalphBacon I think it's very much about choosing the right board for the project isn't it.
      So often I come across tutorials for outside temperature loggers that start by saying "purchase this £40 Raspberry Pi" and I think surely a £2 ESP8266 would be so much better. Other times there are forum posts by people trying to parse a 150kB string in Arduino and wondering why it runs out of memory.
      Commercially of course it is all about optimisation to save 3p per unit on the BOM but I'm not sure that's always quite as important to us makers so long as we get the right ballpark and avoid the above examples.
      Interestingly though if you are running out of pins on the 13/85 then have a gander at the ATTiny24A/44A/84A series. They're still quite cheap but have double the IO.
      Brian Lough did a video on the 44 a little while ago on his channel here on TH-cam.

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

    I like your tutorials very much but why not try an Arduino Pro mini with Atmega168 ? They cost £1.2-1.5 including shipping to Norway.
    Or a 3.3 V /8MHZ version ? Very nice with I2C sensors and TFT's.Here is a nice project I'll try with a 13A: spritesmods.com/?art=rocketlogger&page=1

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

      Yes, that;s an option, of course, Mann, but I did want to see what this particularly cheap processor could do. As it turns out - quite a lot!

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

      Found a supplier on Ebay who sells 10 attiny13a 's for less than £5. Ordered 20 just to be sure. 1 k memory is like a KIM-1.

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

    Programming (the old) attinies with Arduino is brain dead :P . Clutterless C is already questionable. It might be fine for the new attiny series that's available.
    As for the debugging: if your program is that complicated that you need serial output to debug, you might have picked the wrong chip with an attiny ;) . Bit banging a single pin should be enough for most cases. Not even serial, just a pulse or pulse train that tells you something about your program state.

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

      always a good way on a small processor without hardware breakpoints and programmer / debugger. use to do this back in the 8086 days when i did not have enough bonus points to use the engineering £50K in-circuit emulator .

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

      I think the Arduino IDE still has a place, but we do need to dig down under the Arduino-speak functions to get to the raw C code for efficiency. Yes, debugging just by lights could be an option. It may _have_ to be an option at this rate!

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

    The new Attiny Generation is very interesting as well. They're pretty low priced, offer a bit more and finally there are also libraries out for them.
    www.technoblogy.com/show?2OCH#cite_note1
    Bitluni did a video about programming them
    th-cam.com/video/AL9vK_xMt4E/w-d-xo.html
    I had a few times bad luck with the Attiny13, especially from China. They sometimes sell Attiny11 as Attiny13.

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

      Mine say ATTiny13 on them so that's OK, right? Ha Ha! I bought them from RS Components so I'm pretty sure they are genuine. I'll look at the New Generation too, that might be fun. And to find out what a UPDI programmer is.

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

    There were computers in the 1950's with more memory than that mcu has. Your limitation is the language and libraries you're using. Try the fridge door alarm project in assembly. Sorry you lost an eye programming the attiny13...

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

      Indeed, the Arduino high-level language is not helping me here, but I am getting good-ish results, sort of... we shall see. My eye is hopefully going to get fixed eventually!

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

      @@RalphBacon hi there, I did have success with assembly and pic10f200. I wouldn't advise anyone to bet on it to be done again reliably. However, I did build a serial to morse code transceiver with 16 characters transmission, albeit on pic10F222.

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

      Sounds as if you are always up to a challenge too!

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

      @@RalphBacon my take on this, we should use smart hardware not smart programming. Smart hardware is as cheap these days, scalability and efficiency project upwards as well. Productivity becomes improved in terms of number of ideas and implementation of fewer mental aerobatics. Which in turn means more time for us to think of other hurdles to solve. However, SoCs have become too challenging as of late. There are low end and mid ranged choices. We might still enjoy more cycles per second and storage space. Most importantly floating point operations and 32 bit registers. All in all, the IDE makes smooth sail of the implementation stage, it either sinks your efforts or multiplies them. I would pick the IDE first, the SoC second, lastly the libraries.

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

    I would hate the attiny13 chip! The 85 is superior in every way and so much easier to program. The only draw back is cost but for us DIYers that's not really a problem.

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

      I hear you! But it's surprising what _will_ fit inside a Tiny13. Stay tuned!

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

    This will for sure be an exercise in writing tight code, and that's is fine if you like that. Microchip have some other more modern, very low cost and low current consumption alternatives which use 'avrxmega3' architecture. These new AVR's have improved support for USART, SPI and I2C, and 2K flash. The only culprit is the new UPDI programming interface and that you need a new core library. Spence Konde have it all here: github.com/SpenceKonde/megaTinyCore/blob/master/megaavr/extras/ATtiny_x02.md
    It would be awesome if you could have a look into that ATtiny-series in the future.
    I have a similar cat problem, they like to open the refrigerator during the night -- so I may have to design some alarm or find something that solves this ;-)

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

      Barbed wire should do the trick.

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

      I'll have a look at that new chip, as we have such a in-depth GitHub available, thanks for the heads up. And yes, you can create a very simple Fridge Door Alarm using a Tiny13. My problem is squeezing all the existing functionality into it. Stay tuned, see what I come up with.

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

    Bizarrely, I am watching in June 2023

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

      Hmm, why is that bizarre? Was there a future reference to June 2023 in the video?

    • @timmuston2687
      @timmuston2687 ปีที่แล้ว

      @@RalphBacon yes

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

      How spooky.

    • @garthenar
      @garthenar ปีที่แล้ว

      ​@@RalphBaconYep, here too. You wished us a happy new year. 🎉

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

    .. on the serial Rx side I did this DMX reciever (250kbps) driving some WS2812 pixels, this was just running on the internal resonator
    it is possible to run the ATtiny13A at 15.6Mhz on internal resonator by doubling the osccal to 255 (from memory)
    th-cam.com/video/Krsjzqjq9h0/w-d-xo.html

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

      Nice display, very bright too!
      My Tiny13 OSCCAL is set to 5D - if I "double" that I get a faster chip? How can I do that, Bob? 255 (FF) is not double 5D. How does that work, exactly?

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

      @@RalphBacon Sorry, my error... OSCCAL can have a value from 0-127 I believe, in the factory they are set to give you 9.6Mhz-ish, and this is probably where your 5D comes in, this is the value they set to calibrate that particular chip to give 9.6mhz, all I did was look at the range and put OSCCAL = 124;
      in my code (you only need to put it once, after that it retains the value) and found my ATTiny13 to be operating at twice the speed as I was getting nearly 16MHz out of it (when tested with a comparative toggle sketch), obviously this speed is over-ruled if you use a crystal. I think the effective doubling will throw your millis() out because the compiler will still think its delivering 9.6MHz.. so a new boards.txt entry may be required

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

    Realisticly these tiny processors with very limited flah and RAM are not designed for high level programming , best is programming in assembler, or atvleast a high quality optimising compiler. Arduino while very effective and simple for low level programmers is far too inefficient in code generation to work well on these low memory capacity.

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

      Well, yes, I think the comments here reflect that sentiment but if we use direct port manipulation and avoid the bloaty Arduino wrappers we might be OK. And we can always add in some inline assembler, as others have already done.

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

    Debug/develop your code on an ATTiny85 and "port" it to the ATTiny13a minus your space hungry serial.print statements.

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

      Tried that, Rodney, and found the code was too big to fit. The Tiny85 is quite a different kettle of fish compared to the Tiny13 (8K Flash, 512b SRAM vs 1K Flash, 64b SRAM). It's best, I've found, to develop on the Tiny13 and keep compiling regularly so you know how much space that last command you typed used up!

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

    Ralp, you are obviously salty that MCU did not meet your expectations. It is a lowest low end, it is meant for optimized code and not for a 'library' coding.

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

      Well, let's see how far I get with my Fridge Door Alarm project and what compromises I have had to make - or even whether I can do it!

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

    And Lukas used an old version of my asm serial code for txByte in uart.c. He deserves some credit for converting it to inline asm, which can be more complicated than writing straight asm.
    github.com/lpodkalicki/attiny13-software-uart-library

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

      Indeed, Ralph, I'm going to (properly) mention Łukasz Podkalicki in my next ATTiny13 video as his website has given me some good pointers, not least for creating tones that don't cost several hundred bytes to do. He's obviously very capable but I just ran out of time in this video (but did nudge viewers towards his "100 projects with the Tiny13".

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

      Ralph Doncaster, I found this code many many years ago. Modified it as you mention but saved without credits for the author. After some years I published this version on GitHub. Are you the author of the original asm code?

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

      @@lpodk Yes, it looks like a version I put out 6 years ago just before I started using github. Later in 2014 I released a slightly better version that calculates the bit delay at compile time, instead of passing it in a register. It looks like you partially did that with your mods, loading txdelay into r28 before the output loop. You could save a register and one instruction using the updated version.
      github.com/nerdralph/nerdralph/tree/master/avr/libs/bbuart
      p.s. I'll probably release an improved RxByte routine to solve some problems MicroCore and ATTinyCore are having with receiving at high baud rates.

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

      @@RalphDoncaster I've added credits inside source files. This part works really good. Great job. I'll definitly check the updated version.

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

    How to upload hex code to attiny 13A chip

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

      You need to use the ICSP method, Ruwan. That means connecting an Arduino via the ICSP socket to the ATTiny85's equivalent ICSP socket. The Arduino runs the "Arduino as ISP" sketch and will upload to the tiny85 as long as you remember to "Upload using programmer (Arduino as ISP)" instead of just "Upload".

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

      @@RalphBacon thanks i will try

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

    Hi Ralph, you can do some very interesting things with an attiny13a, I did this 8 colour video driver a few years back
    th-cam.com/video/YSRZ4AdZVrU/w-d-xo.html

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

      Impressive what you managed in just 830 bytes, Rob! But what a waste! You had another 194 bytes to play with, ha ha!

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

      @@RalphBacon I know, I could have put a paddle controller in those wasted bytes - it was just a bit of fun, although I think my best colour efforts came from this video th-cam.com/video/IlkEMJtieXM/w-d-xo.html which gave 17Bit colour from a standard 16Mhz Arduino Nano

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

    Recommend to check what Ben Heck Hacks did end of 2018 with ATTiny10 (6pin) pretty teaching video for new comers.

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

      I've found his channel on TH-cam, I will check it out, thanks.

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

    Time to use Embedded C

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

      You could be right! But Raph Doncaster has got my code down to just a few hundred bytes now (about 300 bytes, not including the 40 bytes for the touch switch).

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

      @@RalphBacon I recommend to try Embedded C anyways. Atmel Studio 7 and some custom tool for uploading code. There is TH-cam tutorial for setting that up, but with Arduino Uno.

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

      I'll check it out, I have the page loaded right now.
      dbc-projects.net/arduino-embedded-c/

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

      The link to the software on that page didn't work, and when I found it with a search it seemed to want to give me *.exe files, which on my linux box are not terribly useful. Oh well...

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

    ha .. you don't really know what "limited" means before you have used the PIC 10F200 ^^

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

      Sounds painful. Let me guess, you had two bytes of Flash and a nibbl of SRAM?

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

      @@RalphBacon not quite as bad. 256 words of flash and 16 bytes ram. but what hurt the most was the lack of interrupts

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

    Zombie Chip

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

      Ah ha! You mean it is brain dead but still alive, somehow? We shall see.