#avr | Logs for 2016-04-07

Back
[02:45:05] <edwardoid> Hi guys. I want to control huge load ~40-50A using triac. How bad idea it is?
[02:46:19] <liwakura> i guess that depends on the characteristics
[02:46:37] <Mr_Sheesh> AC powering a load? Should be OK, maybe use an opto triac & maybe get one that switches on zero crossings? Then heat sink it if needed
[02:47:10] <liwakura> heat dissipation depends on the internal resistance..
[02:47:23] <edwardoid> yes, AC, 220V
[02:49:39] <Mr_Sheesh> 40-50A through a triac seems good to at least consider CHECKING if heat sinking's needed, high enough current :)
[02:50:10] <Mr_Sheesh> 1A or 20 mA I might not suggest it
[02:51:10] <edwardoid> I'm going to use triac BTW69-1200RG + moc3021 optocouple
[02:51:24] <liwakura> uhm
[02:51:26] <liwakura> another question
[02:51:37] <liwakura> 10000 Watts?
[02:51:50] <liwakura> what are you doing? melting aluminium in your kitchen?
[02:52:02] <edwardoid> sinking is also a problem, cause I want to a make a silent device
[02:52:13] <edwardoid> no, heating system
[02:52:58] <liwakura> i can't even draw that much, i think my whole flat is capped at 32 A
[02:53:48] <edwardoid> I'm going to be able to control something like https://waffarha.com/images/2030.jpg
[02:54:07] <liwakura> oh
[02:54:15] <liwakura> an inside-out-toaster
[02:54:29] <edwardoid> Device on pictures consumes 1000 Watts
[02:55:15] <edwardoid> As i remember :)
[02:55:29] <edwardoid> anyway I should be ready to control big current
[02:58:07] <edwardoid> and one usecase is create device to control electricity, when you're not at home, for example
[02:58:33] <edwardoid> you send a sms to avr, and it turns off everything at home
[03:02:36] <liwakura> you are switching your whole house?
[03:02:55] <edwardoid> yeah
[03:03:31] <Mr_Sheesh> clocks all off too
[03:05:43] <edwardoid> my clocks works on batteries
[03:05:51] <edwardoid> 2 x AA
[03:06:15] <edwardoid> the only problem is fridge
[03:07:29] <edwardoid> if you going to leave home for a 10-15 days, you can turn fridge too
[03:08:25] <liwakura> hm
[03:08:31] <liwakura> i dont have many things in the fridge
[03:08:46] <edwardoid> fridge is an example
[03:10:56] <edwardoid> also I have an idea to create a cnc, with a generic holder
[03:11:30] <edwardoid> which can be used for drawing, drilling holes and soldering home-made pcbs
[03:11:37] <edwardoid> or something like that
[09:02:03] <flyback> http://www.excitron.com
[09:02:05] <flyback> cool site
[10:30:00] <WormFood> http://www.excitron.com/webdocs/Items/Details262.cfm <-- at least they're honest. List price $400. Their price $500. You save $-100
[10:35:41] <Chillum> haha
[10:35:53] <Chillum> brilliant!
[10:36:04] <WormFood> It was the first thing I randomly picked.
[10:36:20] <WormFood> I thought their prices seemed a little high. Now I know why.
[10:38:51] <WormFood> flyback http://www.excitron.com/webdocs/Items/Details262.cfm <-- at least they're honest.
[12:13:26] <stephe_> LeoNerd: got the pololu v2
[12:13:41] <stephe_> now i need to buy some more avrs
[12:14:40] <LeoNerd> stephe_: Then we shall compare notes :)
[12:14:59] <stephe_> :) you get your v1?
[12:15:14] <LeoNerd> Yup. Came on Tuesday
[12:15:24] <stephe_> nice
[12:15:59] <LeoNerd> Have't actually had a chance to use it yet.
[12:20:02] <stephe_> are you stocked up on avrs though?
[12:22:52] <LeoNerd> I have a box of various ones. 5 mega328p, 3 mega88; various mixed tiny. 84, 85, 13a, 2313... some 841 SMTs too
[12:28:00] <xMopxShell> what's the smallest (pin count) avr mcu with spi master/slave? attiny87 is the smallest ive found so far.
[12:29:42] <LeoNerd> tiny1623 has one. SOIC-20
[12:29:59] <xMopxShell> ah sorry i forgot to mention PDIP would be preferred
[12:30:16] <LeoNerd> Most of the other tinies have a USI which can act as an SPI master or slave
[12:30:32] <xMopxShell> Interesting. ill research that.
[12:31:05] <LeoNerd> USI as SPI master is really quite easy. Slave requires a bit more work
[12:31:54] <LeoNerd> It's about halfway between a full SPI module and bitbanging. The hardware contains the shift register but you have to provide the bit clocking in software.
[12:39:17] <RikusW> hi megal0maniac
[12:49:59] <xMopxShell> gotcha, thanks
[14:17:42] <edwardoid> hi guys
[14:18:06] <edwardoid> I've just killed 2 atmega328p
[14:18:21] <edwardoid> but I have 1 working atmega328p and one atmega8a
[14:18:55] <edwardoid> can I rescue my dead atmegas without fuse doctor, cause printing fuse doctor is too long
[14:19:04] <edwardoid> and I haven't enough components
[14:19:20] <edwardoid> i need something more primitive, just to reset fuses
[14:21:21] <edwardoid> any idea?..
[14:22:30] <bss36504> what fuses did you improperly set?
[14:22:50] <edwardoid> don;'t remember...
[14:23:16] <edwardoid> probably I changed BOD, ans SCSEL
[14:23:32] <bss36504> What environment are you using? Atmel Studio or...
[14:23:46] <edwardoid> programmed fuses with avrdude from commandline
[14:23:55] <edwardoid> i need something like this: https://www.youtube.com/watch?v=olh3A8myzlo
[14:23:58] <bss36504> FWIW, change one fuse at a time in the future, and be careful
[14:24:27] <bss36504> What programmer do you have?
[14:24:35] <edwardoid> but I can't find firmware and schematic
[14:24:45] <edwardoid> usb ISP
[14:24:53] <edwardoid> 2 of them
[14:25:22] <edwardoid> also I have an arduino uno r3
[14:28:58] <bss36504> well as far as I'm aware there is no way to recover fuses without HVPP, which you need a programmer capable of doing. If you just borked up the clock settings, try applying a TTL clock signal on the clk pin and attempt recovery normally.
[14:30:01] <edwardoid> TTL you mean generate a pulse using another avr, and connect to target one?
[14:30:25] <edwardoid> In the video I mentioned guy recovered fuses using simple HVPP
[14:30:28] <bss36504> another avr, a function generator, etc...
[14:30:41] <bss36504> Yes, HVPP is "simple" if you have a programmer to do it.
[14:31:01] <edwardoid> ok, how should I connect source avr with target?
[14:31:23] <edwardoid> let say all pins on port B are generating pulses on 1Mhz
[14:31:24] <bss36504> but it's kind of an "oh $hit, I broke this" last resort, not a general programming method. The AVR dragon and STK500 support HVPP AFAIK
[14:35:44] <bss36504> which is, your recovery avr or the target?
[14:36:45] <edwardoid> target is atmega328p
[14:36:58] <edwardoid> for source i can use atmega328p or atmega8
[14:44:24] <bss36504> Ok, but somewhere you're going to need to have the high voltage component. I suggest googling designs for a HV parallel programmer, and see what you can do.
[14:59:34] <LeoNerd> It would help to know what fuses you've changed
[14:59:47] <LeoNerd> As if it's just clock source, you can just apply an appropriate clock and set them back
[14:59:57] <LeoNerd> If you've changed SPIEN or RSTDIS then that becomes harder
[15:00:40] <edwardoid> I'm sure SPIEN is ok
[15:01:31] <edwardoid> I'm applied 12Mhz, 16Mhz and 20Mhz crystals without any success
[15:02:25] <edwardoid> then I generate ~1Mhz ticks using another avr
[15:03:16] <edwardoid> while(1) { PORTB ^= 0xFF; }
[15:04:18] <edwardoid> and then I connected a ping from port B to a XTAL1
[15:04:48] <edwardoid> So probably problem is not only in clock
[15:04:49] <liwakura> edwardoid: nice idea.
[15:05:06] <edwardoid> thanks, but it didn't helped
[15:06:34] <edwardoid> so I need an high-voltage programmer
[15:07:08] <edwardoid> I saw an simple fuse resetter
[15:07:23] <edwardoid> but can't find its schematic and firmware for source chip
[15:12:45] <LeoNerd> I have an HVSP one for tiny chips but that's no direct use to you currently
[15:12:45] <LeoNerd> However, that + a couple of 74'595s can make it work
[15:12:45] <LeoNerd> HVSP is basically just HVPP with SRs in front anyway
[15:16:36] <edwardoid> any schematic? can you draw it on a paper and send me a pic?
[15:24:25] <jancoow> Hi there. For some reason, the adc intrupts is continue fired.. This is my code: https://jancokock.me/f/8207b
[15:24:45] <jancoow> I can't figure out why
[15:26:00] <liwakura> lol wat
[15:26:09] <liwakura> i can read your ...
[15:26:12] <liwakura> what language is that?
[15:26:21] <jancoow> oh sorry. That's dutch :)
[15:26:23] <liwakura> its like gibberish german
[15:26:27] <jancoow> hahahaha
[15:26:37] <jancoow> that's true :D
[15:26:44] <liwakura> also
[15:26:53] <liwakura> do you read the adc stuff in the interrupt?
[15:27:06] <liwakura> usually an interupts gets fired as long as some flag is set
[15:27:28] <liwakura> and the interrupt disables that flag somehow
[15:27:34] <jancoow> yes i do read the ADCL register which get's the value
[15:27:42] <jancoow> which contains*
[15:28:02] <liwakura> also, isn't that the default mode?
[15:28:08] <liwakura> to fire the interrupt again and again?
[15:28:19] <jancoow> maybe that's the free running mode?
[15:28:21] <liwakura> everytime a new value is ready?
[15:28:34] <jancoow> oh well that could be true..
[15:28:35] <liwakura> hm. i don't know what half of the flags mean
[15:28:50] <jancoow> ADCSRA |= (1 << ADFR); turns it in free running mode
[15:29:38] <liwakura> ah. its even documented in english
[15:30:24] <jancoow> what i basicly wanna do is when the value changes do something
[15:31:12] <liwakura> uhm
[15:31:23] <liwakura> maybe you should poll instead of using interrupts
[15:33:50] <twnqx> do you sleep()?
[15:35:50] <jancoow> poll would take to long for waiting for the result
[15:38:01] <edwardoid> who has installed EAGLE>
[15:38:02] <edwardoid> ?
[15:44:05] <bss36504> @edwardoid yup, I have
[15:53:47] <edwardoid> please open file from here: http://www.instructables.com/id/AVR-High-voltage-programming-Fuses-rescue/
[15:53:59] <edwardoid> and send me a chemaic as a png pic?..
[17:38:59] <yids> hello
[17:39:30] <yids> I would like to build this https://sites.google.com/site/lofturj/ad8307-power-meter, but i dont have a teensy and dont want to use the atmel studio
[17:40:52] <yids> the avr experience that i have is bascily building some simple stuff and compiling it use some arduino make system that kinda does everything in its own arduino ways and stuff
[17:41:47] <yids> would like to run this on atmega328 (arduino pro mini), any tips on how to build this and what kind of issues (different pin defefitions etc) i am gonna encounter?
[17:42:02] <yids> by build i mean compile
[17:45:11] <yids> for the compiling part, i guess just making a makefile would be the way to go no?
[17:47:02] <LeoNerd> stephe_: Just used my v1 programmer here. Seems to work fine. Faster than my usbasp. Als smaller. Tiiiiiny. I'm amazed how small it is.
[17:48:42] <LeoNerd> Lambda_Aurigae: Also, my unit doesn't have the markings burned off the chip. I can read it clear as day. It is indeed a PIC; it's a PIC18F14K50-I/SS
[18:12:26] <twnqx> LeoNerd: my isp fits completely into the usb plug :P
[19:55:01] <Lambda_Aurigae> LeoNerd, kewl.
[19:55:15] <Lambda_Aurigae> LeoNerd, interestingly, that chip can do usb without a crystal too.
[19:55:53] <Lambda_Aurigae> it is very similar to the 16f1455 that I thought it was...just a bit more powerful.
[20:59:22] <Krampus> Does anyone know why a port address (eg, &PORTB) when passed to a function (type volatile uint8_t *) would show up in gdb-avr as having bit 20 set as passed in? Like PORTB becomes 0x800025.
[20:59:55] <Krampus> (and then my avr restarts, which I assume means it wasn't just a gdb artifact. :))
[21:01:44] <Lambda_Aurigae> yes.
[21:02:32] <Lambda_Aurigae> one of those things where it maps the ram and such to the flash memory address space.
[21:03:36] <Lambda_Aurigae> http://www.atmel.com/webdoc/AVRLibcReferenceManual/FAQ_1faq_port_pass.html
[21:06:35] <Krampus> Lambda_Aurigae: seen that. I'm gonna go take one more look, but I'm almost sure I'm doing it exactly the same way.
[21:06:50] <Krampus> Lambda_Aurigae: erm, "as set_bits_func_correct" of course. :)
[21:07:09] <Lambda_Aurigae> and you are accessing it as *port ??
[21:07:27] <Krampus> *port |= mask_high;
[21:08:01] <Krampus> static void write_byte(volatile uint8_t *port, uint8_t pin, uint8_t data);
[21:08:16] <Krampus> called as write_byte(&PORTB, PB4, 0x55);
[21:08:52] <Krampus> as soon as it hits *port |= mask_high, it resets, which I'm assuming means it's hating on what I told it to deref. :)
[21:09:38] <Lambda_Aurigae> yeah...
[21:09:46] <Lambda_Aurigae> looking at another site that shows it the same way.
[21:10:03] <Lambda_Aurigae> http://www.nongnu.org/avr-libc/user-manual/FAQ.html#faq_port_pass
[21:10:26] <Lambda_Aurigae> I would look at your assembly output and compare it there and see what's up.
[21:10:44] <Lambda_Aurigae> see what the compiler is doing to it.
[21:10:55] <Krampus> yeah, I did it essentially the same way (pointer in a struct), didn't work. Found the example, didn't work. Now i've got the second opinion. Clearly, the universe wants me to go outside today. :)
[21:11:24] <Lambda_Aurigae> I would double check the assembly.
[21:11:26] <Krampus> oh, derp. I was looking at the disassembly of the call. Probably ought to see what it translated &PORTB into.
[21:11:34] <Lambda_Aurigae> maybe the new version of gcc breaks it.
[21:12:18] <Krampus> Lambda_Aurigae: dude, don't get me thinking like that. Compiler version quirks are bad times.
[21:12:42] <Krampus> avr-gcc 4.9.2 FWIW though
[21:12:52] <Lambda_Aurigae> hehe.
[21:13:19] <Lambda_Aurigae> I'm a bit behind at 4.8.1
[21:13:29] <Lambda_Aurigae> but don't have any AVRs handy to test it on here.
[21:13:43] <Krampus> I told it to apt-get and it apt-got that one.
[21:13:57] <Lambda_Aurigae> debian or ubuntu?
[21:14:02] <Krampus> ubuntu 16.04
[21:14:35] <Lambda_Aurigae> ubuntu 15.10 on this machine at the moment.
[21:14:45] <Lambda_Aurigae> kubuntu actually.
[21:15:06] <Krampus> same. I'm a gnome refugee!
[21:16:03] <Lambda_Aurigae> latest gnome on ubuntu has some,,,,,issues.
[21:16:14] <Lambda_Aurigae> I don't care much for the kubuntu menu but it's growing on me.
[21:17:29] <Krampus> Lambda_Aurigae: I think I'm going to check out Arch Linux and i3 for a WM in the next couple weeks.
[21:17:41] <Lambda_Aurigae> bout to pull the ssd out of the tower and put it in this laptop.
[21:17:54] <Lambda_Aurigae> when I do that I'll put a newer kubuntu on this laptop.
[21:30:08] <Krampus> Lambda_Aurigae: weird... so avr-objdump is being weird with how it's showing the source and assembly like it was ignoring the -Og flag
[21:41:01] <Krampus> Lambda_Aurigae: i think i figured it out. I had a typo in a delay loop that i think caused it to roll over to negative hojillion. The WDT then comes in and cancels christmas.
[23:05:00] <WormFood> yids, converting from one avr to another is usually doable, if the target avr doesn't lack features needed by the source avr. You may need to tweak some of the registers, if the peripherals operate differently. And, you may need to contend with register and bit name changes. Arduino uses numbers for all their pins, so you'll need to figure out the real avr name of the pins you want to use, and map it back to the arduino pin number.
[23:06:56] <WormFood> yids, I recommend getting the schematics to your arduino, and then you'll *know* what exactly goes where. I have an arduino, but I don't use the arduino tool stack. Now it's just an AVR, with an Arduino layout.
[23:49:00] * Xark notes Arduino "tool stack" (toolchain) is fairly normal avr-gcc, it is just their "code libraries" you may want to avoid (and these are in source). In fact, if you put your code in "void main()" (instead of void Setup() etc.) you bypass all its code and get a normal AVR build (even building in IDE).