#avr Logs

Nov 08 2017

#avr Calendar

12:37 AM polprog: Emil: breainfart :P i dont know why it looked like a schmitt to me lol
02:10 AM day__ is now known as daey
02:32 AM Ameisen: SP: 8536
02:32 AM Ameisen: huh, that's not good
02:32 AM Ameisen: atm2560 only has 8KiB of RAM... so... how is the SP 8536?
02:44 AM JanC is now known as Guest4348
05:02 AM Emil: nuxil: autoamtic voltage selector
07:07 AM Emil: polprog: http://oscilloscopemusic.com/vinyl.php
07:07 AM Emil: You might like that
07:07 AM Emil: It also has free download
07:11 AM nuxil: Emil, https://www.youtube.com/watch?v=vrCjeQGavSE
07:11 AM nuxil: :D
07:22 AM nuxil: i think one has to be a special kind of nerd to make oscillioscope art :p
07:22 AM Emil: Nooo
07:22 AM Emil: Well
07:22 AM Emil: EEs are special
07:24 AM nuxil: its cool to look at though.
07:31 AM polprog: Emil: looks cool, ill check it out after school ;)
07:57 AM polprog: https://puu.sh/yhs3z/ce0f210e44.jpg
08:49 AM splud: Emil, you still around?
08:49 AM splud: if so, yesterday you posted a link to https://emil.fi/jako/kuvat/2017-11-07_16-35-22_i4sjRsLg.png
08:51 AM splud: I didn't see any associated discussion, but am wondering about the diode bridge, resistor divider and LM321 to the right side -- was that intended as a voltage/phase detector, or is it being used to detect zero crossing?
09:01 AM Thrashbarg: that can only end in smoke :/
09:02 AM thardin: connecting directly to the grid? yikes
09:02 AM Emil: splud: of course I am here
09:02 AM Emil: splud: but you left
09:03 AM Emil: splud: voltage+zeeo crossing
09:03 AM Emil: Thrashbarg: thardin bullshit
09:04 AM thardin: hm?
09:04 AM Thrashbarg: Emil: I await your results :P
09:04 AM thardin: trafo or opto pls
09:04 AM Thrashbarg: agreed
09:05 AM Emil: thardin: trafo?
09:05 AM Thrashbarg: transformer
09:05 AM splud: Tons of stuff connects to mains with no problem.
09:05 AM Emil: Thrashbarg: point me to a small signal transformer and I will
09:06 AM Thrashbarg: splud: assuming nothing else connects to it, i.e. it's double insulated
09:06 AM Emil: lemme share the space resteictions
09:06 AM thardin: caps as voltage dividers would be ok possibly
09:06 AM Thrashbarg: nope
09:06 AM thardin: then you get some galvanic isolation
09:06 AM Thrashbarg: nup!
09:06 AM thardin: but they need to fail the right way
09:06 AM Emil: https://emil.fi/jako/kuvat/2017-11-07_17-39-14_qnJbgyrQ.png
09:06 AM Emil: https://emil.fi/jako/kuvat/2017-11-07_17-48-18_yQBdkMl4.png
09:07 AM splud: use X2 or Y2 rated caps if you're doing CR circuits.
09:07 AM splud: But protect everything with fuse and MOV as well.
09:08 AM Emil: wtf, caps dont provide any isolatio
09:08 AM Emil: they are just morw efficient
09:08 AM splud: I didn't make that claim, just said to use X2 or Y2 rated ones.
09:09 AM splud: But that's for _powering_ a low power circuit, not for merely connecting to read.
09:09 AM Thrashbarg: to do that you'd have to reference the GND side of your circuit to neutral, which means the whole thing would be at mains potenial
09:09 AM cehteh: well as i saied cap + opto
09:09 AM splud: Consider a "Kill-A-Watt" plug-in power metre - there's buttons (plastic) and an LCD display, and the thing plugs into the wall with a load plugged into it. There is no transformer in there.
09:09 AM Thrashbarg: yup, but they're double insulated
09:10 AM Thrashbarg: Emil: looks like you're making an Arduino shield to do this?
09:10 AM cehteh: but sometimes it is ok when the whole thing floats on mains level, as long it has no wires going out, its well protected and isolated
09:10 AM Thrashbarg: it is yes
09:10 AM Thrashbarg: i.e. double insulated :P
09:10 AM thardin: it can be yes
09:10 AM thardin: I'm a bit curious if GND == earth in that one
09:11 AM Thrashbarg: yup
09:11 AM Thrashbarg: because that ain't gonna work
09:11 AM thardin: now I'm no electrician, but oftentimes either L or N is earth
09:11 AM Thrashbarg: need to pretend neutral is 0V, and have the whole circuit floating
09:12 AM splud: If L is earth, your electrician fscked up.
09:12 AM Thrashbarg: earth is there for protection, not as a voltage reference
09:12 AM thardin: I can insert my plugs either way into my sockets
09:12 AM thardin: but maybe this is a weird U.S thing
09:12 AM Thrashbarg: yeah the US has a weird way with electricity :P
09:12 AM splud: split phase. ROW has L-L.
09:13 AM splud: Yea, but at least we have 60Hz power.
09:13 AM thardin: I think you can get shit induced on N too, in certain cases
09:13 AM Thrashbarg: you also have 29.97FPS video as a result xD
09:14 AM splud: nominally more efficient, AND a handy time reference that more closely tracks clock time.
09:14 AM Thrashbarg: 400Hz AC is more efficient
09:14 AM thardin: It Depends
09:14 AM splud: Aircraft, yea.
09:14 AM thardin: 400 Hz has too short wavelength in some cases potentially
09:15 AM splud: and by tracks clock time, I mean using a progression of the same number base.
09:15 AM Thrashbarg: indeed
09:15 AM splud: though 50Hz with two zero crossings allows for easy 1/100 second intervals.
09:15 AM Thrashbarg: yay decimal time
09:15 AM thardin: if you have higher frequency then you need to cross mains lines more often
09:16 AM splud: decimal, until you get to seconds, minutes, hours,...
09:16 AM Thrashbarg: :P
09:16 AM thardin: it's similar to twisted pair as I understand it
09:16 AM splud: higher frequency = smaller transformers.
09:16 AM splud: Switchmode takes that even farther.
09:17 AM thardin: more radiative losses
09:17 AM Thrashbarg: yeah
09:17 AM Thrashbarg: drive the hams nuts
09:17 AM Thrashbarg: Thu 9 Nov 01:15:51 ACDT 2017
09:17 AM Thrashbarg: I should sleep....
09:17 AM splud: Sleep is overrated.
09:17 AM thardin: oh yeah, all unshielded smsps must burnm
09:17 AM splud: Time enough for that when you're dead.
09:17 AM Thrashbarg: hehe
09:18 AM Thrashbarg: I agree but I can't fight biology
09:34 AM merethan_: I have a funny issue with my x32e5 & xboot: Chip erase does not erase the whole flash, but rather about 1/3 of it, in a repetitive pattern.
12:33 PM Emil: Thrashbarg: lolno
12:33 PM Emil: Thrashbarg: what fucking arduino shield pls no :D
02:01 PM polprog: is 100n a good decoupling cap for m16?
02:01 PM polprog: there will be 4 total, for each vcc pin
02:01 PM polprog: or is 100n too much? i have 4n7 as well
02:02 PM LeoNerd: 100n is typical
02:02 PM Emil: polprog: 1u best
02:03 PM polprog: ill go with 100n
02:03 PM polprog: im making a desk clock finally
02:03 PM Emil: polprog: 100n is definitely not too much
02:03 PM Emil: 100n is minimum
02:03 PM Emil: 1u is best
02:04 PM LeoNerd: I usually put a 10µ somewhere on the board usually at the power input connector, and then a 100n per chip
02:08 PM cehteh: 100n per chip, 4.7µ Tantal somewhere per functional unit, biggier wet capt per board *IF* your vreg permits that
02:09 PM LeoNerd: Heh... tantalum if you want a surface-mount incendury device ;P
02:09 PM cehteh: be careful some vregs dont like too much capacitance on the output side and also define a range of ESR where they run stable
02:10 PM cehteh: oscilating with too low esr and all shit may happen
02:11 PM LeoNerd: Yah; that's usually why I put the 10µ on the supply directly into the board, even before any regulator
02:12 PM cehteh: yes before the vreg there is usually no limit, i'd even go for 100-470µ ... if the power supply can charge them in reasonable time
02:13 PM polprog: should i put a small resistor at mos' gate?
02:13 PM LeoNerd: I usually pick a 10 because that's about the biggest I can find in MLCC
02:13 PM cehteh: you dont want slow rising power
02:13 PM polprog: mosfet's*
02:13 PM LeoNerd: polprog: "maybe"? Depends - some scenarios want it, some don't
02:13 PM cehteh: depends on what fet you use and how you drive it
02:13 PM polprog: BSS138 switching on a common pin of a 7 segment, driven directly from the avr
02:14 PM cehteh: when slowly switching, it doesnt matter and doesnt harm, just add one
02:14 PM polprog: it's a small mosfet
02:14 PM polprog: eh screw it ill put it there
02:14 PM Emil: polprog: you don't need it
02:14 PM Emil: polprog: absolutely unnecessary overengineering :D
02:14 PM cehteh: when doing higher freq PWM it needs to be somewhat within magic limits
02:14 PM polprog: ok
02:14 PM Emil: cehteh: with AVRs, lulz
02:14 PM cehteh: for a small FET .. no need yes
02:14 PM Emil: only if driving big enough power mosfets
02:15 PM cehteh: i was just thinking when you drive some rather big FET and try that without driver
02:15 PM Emil: then the capacitive load can cause big enough momentary current draw that the avr gates don't like it
02:15 PM cehteh: then you want some driver anyway
02:15 PM Emil: yeah
02:15 PM cehteh: but that needs to be fast enough for your PWM shit
02:16 PM LeoNerd: High-speed FET driving is an interesting topic
02:16 PM cehteh: while for slow switching, just drop a R and done
02:16 PM cehteh: anything between 10ohm and 10kohm is likely ok in that case :D
02:16 PM Emil: noo
02:16 PM Emil: I wouldn't put 10k
02:16 PM Emil: 10 to 100 ohms
02:16 PM cehteh: between 0 and 10k :D
02:17 PM cehteh: yeah better less
02:17 PM Emil: There's no reason to go above 500ohms imho
02:17 PM cehteh: but it should work with 10k as well
02:17 PM Emil: Well, if you are slow enough
02:17 PM cehteh: 100ohms are a good start
02:17 PM Emil: or don't care if your fet acts as a resistor
02:17 PM cehteh: at worst you get a fe micro seconds linear drive, any big fet should sustain that
02:18 PM cehteh: (unless you do PWM, i saied slow switching)
02:19 PM Emil: at 100p capacitance and 10k series resistor, your fc is 0.159154943MHz
02:19 PM cehteh: thats how much microseconds?
02:20 PM Emil: 6.28u
02:20 PM Emil: Which is for the fundamental frequency
02:21 PM Emil: Which means you area already getting quite high losses
02:21 PM cehteh: now do the caclulation how much joules you generate when switching that so slow
02:21 PM Emil: cehteh: switching slow is preferable
02:21 PM Emil: if you have a natural low pass filter on the gate
02:21 PM cehteh: then big R wonrt hurt :)
02:22 PM Emil: ....
02:22 PM Emil: wtf
02:22 PM Emil: cehteh: do you even ee
02:22 PM cehteh: no, i am hobbyist
02:22 PM Emil: 10k is wayyyy too much series resistance for gate
02:22 PM cehteh: but it wont hurt when you switch infrequently
02:22 PM Emil: The only point of the series resistor is to limit the slew rate/spike current draw
02:22 PM cehteh: i dont say one should prefer that
02:22 PM Emil: cehteh: it does
02:23 PM cehteh: how?
02:23 PM Emil: and 100 ohms limits it just fine
02:23 PM Emil: 10k is already two order of magnitude too big ;)
02:23 PM cehteh: but what does that cause?
02:23 PM Emil: inefficiency, breaking
02:23 PM Emil: heating
02:23 PM cehteh: .. fet switches slower, linear, for few microseconds, generates some loss/heat in that time
02:24 PM cehteh: done
02:24 PM cehteh: which is no problem under the assumption you switch slow and dont do PWM with that
02:24 PM polprog: i see i startled a heated discussion lol
02:24 PM polprog: :D
02:25 PM cehteh: well i'd agree with Emil that you shouldnt add a bigger R than 100 ohms
02:25 PM cehteh: my only argument was that it would work with 0 - 10000Ohms
02:26 PM cehteh: and for a small fet you just dont add any R, gate cappacitance is quite low there, no need at all
02:28 PM polprog: that sorted the knowledge a bit, thanks
02:31 PM polprog: hmm
02:31 PM polprog: that sot23 is too big for the board
02:31 PM polprog: can you recommend any smaller nmos?
02:35 PM Emil: sot23 too big?
02:36 PM Emil: I mean
02:36 PM Emil: sURE
02:36 PM LeoNerd: SC70
02:37 PM LeoNerd: Which I dislike because their legs are usually -really- thin
02:37 PM Emil: polprog: what specs do you need for it?
02:37 PM polprog: it has to fit under 4 2x7 segment displays
02:37 PM Emil: current and voltage capabilities?
02:38 PM polprog: so i have to squeeze everything in 11mm H and 8 cm W
02:38 PM Emil: polprog: do you have a schematic?
02:38 PM polprog: current...50 mA, voltage <5V
02:38 PM polprog: the schem's in the making right now
02:39 PM Emil: polprog: what's the basic idea?
02:39 PM Emil: polprog: an avr, an rtc and a gpio expander?
02:39 PM polprog: basic idea is that it's a small board that completely hides behind the displays
02:40 PM polprog: components on one side, display pins bent to reach pads on component side but the display is on the other side
02:40 PM polprog: single chip avr
02:40 PM polprog: with a crystal obvs
02:40 PM Emil: whatcha need a crystal for?
02:40 PM Emil: if it's a clock
02:40 PM Emil: you keep time with an rtc obviously
02:40 PM Emil: It's far more accurate and durable
02:41 PM polprog: something's got to give the clock signal
02:41 PM Emil: eh?
02:41 PM Emil: clock for what?
02:41 PM polprog: let me put it this way
02:41 PM Emil: of course you have an rtc with a crystal :D
02:41 PM Emil: but that crystal is 32768Hz instead of your typical 16MHz
02:41 PM polprog: i know
02:42 PM polprog: so i will mount a 32768hz crystal as the AVR crystal
02:42 PM polprog: and do the time math in an ISR
02:42 PM Emil: waaaait
02:42 PM Emil: so
02:42 PM Emil: you are not going to have an rtc?
02:42 PM polprog: no
02:42 PM polprog: not enough space lol
02:42 PM Emil: bullshit
02:42 PM Emil: 11mm x 8cm is pleenty
02:42 PM polprog: probably would fit, i know
02:43 PM polprog: but i dont want one
02:43 PM Emil: I should actually design something like that, too
02:43 PM Emil: but also make it wifi enabled
02:43 PM polprog: right now im making a SOD523 footprint in kicad
02:43 PM Emil: There's one already
02:43 PM Emil: I guarantee it
02:43 PM polprog: really?
02:44 PM polprog: ill check again then
02:44 PM polprog: there isnt. and it's alias SC-79 doesnt have one either.
02:44 PM polprog: maybe my library is outdated
02:45 PM Emil: did you add all the other libs that ship by default?
02:45 PM Emil: you need to do that for every project
02:45 PM Emil: because kicad is idiotic
02:45 PM polprog: i know
02:45 PM polprog: the lib stuff is just nuts
02:45 PM polprog: i have all the libs
02:45 PM polprog: i think
02:45 PM Emil: Wellthen
02:45 PM Emil: making one shouldn't take more than 5 minutes
02:46 PM polprog: yea
02:46 PM polprog: anyway i cant wait to get it done
02:46 PM nohitzzz: are you gonna use assembly?
02:46 PM polprog: maybe
02:46 PM Ameisen: g++ program memory limitations are annoying me more than usual today
02:48 PM polprog: footprint creator wizard is rather good
02:48 PM polprog: i just typed some dimensions and it's done
02:51 PM Ameisen: I want to get Clang where it needs to be
02:51 PM Ameisen: so I can add __flash, etc
02:52 PM Ameisen: I'd love to also be able to do, like, switch __flash (var) ...
02:52 PM Ameisen: so the jump table gets put into program memory
03:07 PM polprog: sh....
03:07 PM polprog: i forgot that the pads will make the footprint wider :(
03:07 PM polprog: so i need to use a smaller atmega
03:08 PM polprog: hmm
03:10 PM Ameisen: I suspect, once this firmware and clang work is done
03:10 PM Ameisen: I will migrate my printer to arm
03:10 PM Ameisen: :|
03:12 PM polprog: https://puu.sh/yhI26/be1ccfaf3d.png
03:12 PM Ameisen: looks like it's in polish
03:13 PM polprog: indeed
03:14 PM Ameisen: my ancestors came from what is today poland
03:14 PM Ameisen: well, some of them
03:14 PM polprog: interesting
03:14 PM Ameisen: Was Germany and Russia back then, though
03:17 PM polprog: whoever designed the pinout of QFN mega8 did a great job, a single PORT is scattered on 3 sides :D
03:21 PM Ameisen: so
03:21 PM Ameisen: g++ doesn't like it if you try to set a constexpr through a constexpr through a constexpr, with progmem
03:21 PM Ameisen: it seems to get confused
03:26 PM polprog: this will be a nightmare to route
03:26 PM polprog: even on a 2 sided board
03:28 PM Lambda_Aurigae: so go 8 sided!
03:29 PM Ameisen: use the æther
03:29 PM Ameisen: 3d print a trace going over the the chip to the other side
03:29 PM Ameisen: or just use non-euclidean PCB
03:29 PM Ameisen: the possibilities are endless
03:33 PM Lambda_Aurigae: made my own 4 layer boards in the past.
03:33 PM Lambda_Aurigae: that was fun.
03:33 PM Lambda_Aurigae: a single board that was 2-sided and two more that were single sided.
03:33 PM Lambda_Aurigae: aligning and drilling was fun.
03:34 PM Lambda_Aurigae: then doing the vias required pin and solder and place and solder and place and solder.
03:34 PM Lambda_Aurigae: planning it was lots of fun.
03:37 PM Ameisen: non-euclidean is where it is
03:37 PM Ameisen: make weird PCB geometries
03:37 PM Ameisen: traces _everywhere_
03:49 PM Lambda_Aurigae: I prefer Escher geometry myself.
03:49 PM polprog: it's bus geometry so im running paralell traces on one side and then making connections with vias
03:50 PM polprog: looking good so far
03:50 PM Lambda_Aurigae: definitely need escher geometry for that then.
03:50 PM polprog: ill finish that tomorrow
03:51 PM polprog: i should do something on the job project as well
03:51 PM polprog: weekend will be dedicated to that
03:52 PM polprog: https://www.youtube.com/watch?v=zWi4lH5Xdwk
04:17 PM Emil: polprog: where's the programming interface?
04:17 PM Emil: That's like
04:17 PM Emil: the first thing you add
04:19 PM Emil: polprog: wtf
04:20 PM Emil: Also you need like at least 10u capacitance
04:20 PM Emil: at vcc
04:20 PM Emil: You don't need that fuse
04:20 PM Emil: You don't need that diode
04:21 PM Emil: And you should, but not necessarily needed, add pulldowns on those mosfets
04:22 PM nohitzzz: link?
04:22 PM Emil: And you should really, really clock the avr at a higher frequency and use the rtc crystal as an async source for timer2 (?)
04:23 PM Emil: There should be support for that directly
04:23 PM Emil: nohitzzz: hm?
04:23 PM nohitzzz: to what you are talking about
04:23 PM nohitzzz: schematics i presume
04:23 PM Emil: 2017-11-08 22:40:34 +0200 < polprog> https://puu.sh/yhI26/be1ccfaf3d.png
04:24 PM Emil: the pulldowns on those mosfets are not really needed even if it would be good design
04:25 PM Emil: also wtf, ground that AGND
04:27 PM nohitzzz: this would make a great assembly project
04:27 PM Emil: I could do that at Junction
04:27 PM Emil: polprog: hey, next year, come to Junction, I'll vouch for you
04:28 PM nohitzzz: what's that
04:28 PM Emil: hackjunction.com
04:28 PM Emil: Biggest hackathon in Yurop
04:28 PM Emil: I'm there organising the electronics space
04:28 PM nohitzzz: cool
04:44 PM Lambda_Aurigae: but where is it?
04:46 PM Lambda_Aurigae: that video on the front page is annoying as heck when visiting the page via a teamviewer connection.
04:50 PM nohitzzz: 24-26 November - Helsinki
05:18 PM Lambda_Aurigae: darn...got things planned for that week.
05:18 PM Lambda_Aurigae: that and I can't afford the airfare.
05:18 PM Lambda_Aurigae: and my car isn't amphibious
05:22 PM Emil: Hahah :D
05:44 PM Tom_L: put yourself in a box and ship you there
06:20 PM Ameisen: An interesting thing I've noticed - using constexpr for most things that you'd usually use static const for, including for arrays of uint8s (for packets)... reduced both program memory and RAM usage in the resulting binary.
06:25 PM Lambda_Aurigae: can't say as I've ever used "static const"
06:46 PM Ameisen: static const/const/whatnot
06:46 PM Ameisen: however you'd define something in a function that doesn't ever change
06:46 PM Ameisen: main issue with static const is that it'd be treated as a global
06:48 PM Lambda_Aurigae: I usually use #define.
06:56 PM Ameisen: which is just symbol replacement.
06:57 PM Ameisen: and... isn't quite a replacement anyways
06:58 PM Ameisen: like...
06:58 PM Ameisen: https://pastebin.com/25UpN1Qa
06:58 PM Ameisen: how would you write that in a function?
07:14 PM Lambda_Aurigae: well, I would use const in that normally for any reason I could think of off the top of my head.
07:16 PM Lambda_Aurigae: if it's going to put it into ram as a variable anyhow,,,but, I'm not a professional programmer either and have not had a programming class in C or C++ in my life so there's a lot about it I don't know.