#avr Logs

Nov 07 2017

#avr Calendar

12:02 AM day__ is now known as daey
07:26 AM enh: hi
07:42 AM Emil: Hi
07:43 AM _ami_: Emil: hello, whats up
07:44 AM Emil: _ami_: Doing some ee design for a friend
07:44 AM Emil: _ami_: you?
07:45 AM _ami_: nice. helping a friend with EE skills is always satisfying :)
07:45 AM Emil: _ami_: also, pls, get yourself a vm or something where your IRC runs all the time
07:45 AM _ami_: i was abt to flash an esp8266 with latest firmware.
07:45 AM Emil: _ami_: part selection is annoying as fuck :D
07:46 AM _ami_: :)
07:46 AM _ami_: Emil: yes, i have to set it up
07:46 AM _ami_: will do.
07:46 AM _ami_: soon
08:50 AM Emil: https://emil.fi/jako/kuvat/2017-11-07_16-19-23_mwWHYxUi.png
08:51 AM Emil: mfw
08:51 AM Emil: wattafuuq
08:51 AM Emil: Sellaset kolme kertaluokkaa sieltä
08:56 AM Emil: Ilmeeni https://imgflip.com/s/meme/Impossibru-Guy-Original.jpg
09:07 AM Emil: Alrighty: can you notice anything bad here https://emil.fi/jako/kuvat/2017-11-07_16-35-22_i4sjRsLg.png
09:07 AM Emil: (yes it's still the same thing
11:13 AM splud: Emil, I'm in late on this, just seeing your last few image posts. Are you trying to run something off of mains, or just get a mains voltage reference?
11:14 AM splud: or detect zero crossing perhaps?
11:15 AM splud: (hrm, REALLY late apparently, like 2H)
11:15 AM polprog: i think you could avoid mains by using a transformer power supply.
11:16 AM polprog: that also gives you a single mains cable to the device
11:16 AM polprog: and less hassle with those resistors
11:16 AM polprog: also makes the device a bit more heavier and gives it a nice humming noise
11:16 AM polprog: :)
11:17 AM splud: Well, I'm just seeing a partial schematic in the last link, and no description of what is being attempted.
11:17 AM polprog: neither me. ive seen only the schem
11:17 AM polprog: for the last month or so :D
11:18 AM splud: There are things you can do with a capacitive reactance circuit, they just don't provide isolation (which isn't a problem if the circuit is all packaged up).
11:18 AM polprog: im a bit concerned about that block where you have L, N V+ and V- going in
11:19 AM polprog: next to each other on the schem so maybe close on a pcb
11:19 AM splud: Well, that L/N could just as easily be coming from the output of a transformer.
11:19 AM polprog: but i dont know much about mains isolation design
11:19 AM polprog: yeah
11:20 AM polprog: enh: you could add some narration to your videos
11:20 AM splud: U2 (near the top of the page), is presumably the rectifier bridge - but the schematic doesn't label the rectifier bridge to the right of centre.
11:22 AM nuxil: and no filter caps
11:22 AM polprog: i dont think filter caps are necesary anywhere here
11:23 AM nuxil: umm.. always put filter caps after a rectifier. you dont want that 50/60hz humm :p
11:24 AM polprog: in this case he wants the sine wave output
11:24 AM splud: I'm still lost as to what the actual goal is. Was that declared in a prior exchange? Could someone repeat it?
11:25 AM nuxil: U4 confuses me on this schematics.. what is it suppose to do when exabling Q2 ?
11:25 AM polprog: nuxil: what you are saying is right in case of using the recrifier to produce DC
11:25 AM nuxil: *enabeling
11:25 AM splud: I strongly suspect there's a desire to detect zero cross.
11:26 AM polprog: zero cross? maybe
11:26 AM polprog: all i know is that there is a schmitt trigger on the output of that rectifier
11:26 AM splud: There are however other ways to accomplish that. Also, if the crapton of resistors are there for dropping voltage to power the circuit in the absence of a transformer, a CR circuit would be far more efficient.
11:27 AM nuxil: pwm :p
11:27 AM polprog: if i recall he uses a bunch of smaller resistors for fault protection
11:28 AM polprog: if you used a single say 1M, then if it fails short it gets nasty
11:29 AM splud: different TYPES of resistors have different fail modes.
11:29 AM polprog: i guess you are right
11:29 AM splud: But, if connecting to mains, a fuse and a MOV are always a good ide.
11:29 AM polprog: im just a hobbyist
11:29 AM polprog: MOV = metal oxide varistor?
11:30 AM nuxil: yes thats mov
11:30 AM splud: yes.
11:30 AM polprog: My VGA swtich is in Krakow, still. cant wait wait for it
11:31 AM splud: will conduct if the voltage rises above a threshold. Should protect that with a fuse, so if it fails and shorts, the fuse blows and the device doesn't toast.
11:31 AM polprog: yeah
11:32 AM polprog: i suggested a TVS as well
11:34 AM polprog: https://www.youtube.com/watch?v=6epzmRZk6UU
12:37 PM polprog: latex can be a bitch
12:43 PM splud: wow, that's a loaded statement. Is this the correct forum?
12:44 PM polprog: for the past 20 minutes i was trying to get rid of surplus vertical spacing in a two column arrangement
12:45 PM polprog: latex the text language, prevert ;)
12:51 PM woddy2 is now known as woddy
02:31 PM hetii: Hi :)
02:31 PM polprog: evening :0
02:31 PM polprog: :)
02:31 PM nuxil: howdy
02:32 PM nuxil: polprog, done any more asm tuts ?
02:32 PM polprog: oh I wish I had time lol
02:32 PM nuxil: make time :D
02:34 PM hetii: I want to ask you about experience with nrf24l01 or se8r01 (I use se8r01 but it is similar). I have very weak performance with them, around 8m without wall works fine but just when I hide behind wall I lost connectivity.
02:37 PM hetii: I add caps pn power line as well as 10k pullup on CSN line, set speed to 500Kbps@+5dbm and channel 0 to reduce interference with wifi, but all of that doesn`t change much.
02:47 PM learath: hetii: how is your 2.4ghz environment?
02:48 PM learath: hetii: it looks like the se8r01 has nothing to recommend itself.
03:03 PM hetii: learath, I have maybe two wifi router in the same range
03:22 PM Lambda_Aurigae: and what antennas are on your units?
03:41 PM hetii: Lambda_Aurigae, standard one, so my modules looks like: https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQxozxJKdE6CHyuL-8joUTNYNuSXzQPESAtx5fVO6_E-zgLGhNFdg
03:42 PM hetii: https://image4.geekbuying.com/content_pic/201605/geekbuying-6634e5c0-b6a6-4856-b67b-a33316182076.jpg
05:47 PM Emil: polprog: if you can point me to a _small_ signal transformer I'm all ears
05:47 PM Emil: splud polprog it's the full schematic (of course there's control and adc sense elsewhere but still)
05:48 PM Emil: polprog: it's kicad, it's only a symbol. IRM-03-05
05:49 PM Emil: nuxil: transformer wiring
05:50 PM Emil: polprog: what fucking schmitt trigger where? :D
05:50 PM Emil: splud: I found it super annoying selecting a capacitor for voltage dropping: resistors are super easy to model
05:51 PM Emil: I could still ad MOV (it was there previously) but I got lazy sourcing a good part :D
05:52 PM Emil: hetii: nrf24l01 (I hope you are using the + version, the normal one is deprecated) is shit perf
05:52 PM Emil: you _realy_ fucking need to add filter caps (like 100uF) and shielding
05:53 PM Emil: hetii: also even if your selected channel is another, your front end can still be overloaded with other rf transmissions
05:55 PM nuxil: Alright..
05:55 PM nuxil: yea shielding is important when working with high rf.
05:56 PM nuxil: you dont want pbc traces dancing to your local radio :p
05:57 PM nuxil: *pcb
06:00 PM nuxil: Emil, whats your project?
06:03 PM nuxil: i need sleep cant type.
06:55 PM * nuxil yawns.
06:56 PM nuxil: i need resupplys of chips.
06:58 PM nuxil: which chip do you guys reccomend i start to play with next? been messing around abit with the atiny85. still feel like a noob with it though.
06:58 PM nuxil: i want a chip with a 16bit timer thats easy to start with.
06:58 PM LeoNerd: The tiny85's timers are a bit weird
06:58 PM nuxil: how so ?
06:58 PM LeoNerd: A tiny84 is much more recognisable, as compared something like the good ol' ATmega328P
07:00 PM nuxil: atmega32 stuff is to much for me
07:01 PM Lambda_Aurigae: I like the atmega1284p and pic32mx270f256b
07:01 PM Lambda_Aurigae: I start new students out on the 1284p and second year students get to play with the pic32
07:02 PM nuxil: this one ? https://www.elfadistrelec.no/no/mikrokontroller-bit-dil-40-atmel-atmega324p-20pu/p/17325145?q=atmega1284p&page=3&origPos=3&origPageSize=50&simi=81.23
07:03 PM Lambda_Aurigae: 324p works too.
07:03 PM Lambda_Aurigae: I like the 1284p for the excessive i/o and sram personally
07:04 PM nuxil: hmm. 40kr for 1 chip. around 5bucks for it.
07:04 PM Lambda_Aurigae: bout right.
07:04 PM Lambda_Aurigae: the pic32 has even more sram but fewer i/o pins...is also much faster and a much more complex chip.
07:05 PM Lambda_Aurigae: I find the avr line, specifically the atmega series, to be the easiest chips to work with overall.
07:05 PM nuxil: heh you dont want me to get a pic unless you want me to move in at your basement :p
07:07 PM nuxil: there so much examples and stuff for atmel. tonz of audreeno stuff. but still its usefull. i dont know the pic community. dont know if its bigger or not.
07:07 PM nuxil: atmel seems to be what the hobbeists pic :p
07:07 PM Lambda_Aurigae: arduino is horrid.
07:08 PM Lambda_Aurigae: pic has a bigger following than avr
07:08 PM nuxil: i cant tell.. never had one.. and dont want one
07:08 PM Lambda_Aurigae: pic is also harder to work with...just been around a bit longer as I recall.
07:08 PM Lambda_Aurigae: but, I use pic32 which is not really pic, but kinda.
07:08 PM Lambda_Aurigae: it's a mips processor with pic peripherals attached.
07:09 PM Lambda_Aurigae: and not a harvard chip like regular pic or avr chips...it's a von-neuman architecture.
07:09 PM Lambda_Aurigae: so, whole different world really.
07:09 PM Lambda_Aurigae: it's more like an arm, but not really...
07:11 PM nuxil: you made me google stuff now "von-neuman architectur" :p
07:11 PM Lambda_Aurigae: your computer is von-neuman.
07:13 PM nuxil: yup
07:14 PM Lambda_Aurigae: so, I made you learn something today.
07:14 PM Lambda_Aurigae: chaos, panic, disorder....my job here is done!
07:14 PM Lambda_Aurigae: hehe
07:14 PM nuxil: reading.. ias "1952" was the 1st "modern" machine using this architecture
07:14 PM nuxil: old stuff :p
07:17 PM Lambda_Aurigae: learn the old stuff, learn the new stuff
07:18 PM Lambda_Aurigae: learn as much in between as you can.
07:18 PM Lambda_Aurigae: the more you know the easier it is to learn and do.
07:41 PM enh: hi
07:41 PM Lambda_Aurigae: ih
07:45 PM enh: Fine?
07:46 PM Lambda_Aurigae: huh?
07:46 PM enh: All right?
07:47 PM Lambda_Aurigae: I'm still alive
07:47 PM Lambda_Aurigae: I haven't killed anybody today,,,,but I have a few hours yet.
07:49 PM enh: I'm trying to program the PCA9685 to produce PWM pulses for the servos with 12 bit resolution. I tried to use the output enable of the chip, and the AVR timer, to open an enable window of 2ms and close it for 20ms. But it does not start all pwms at the same time when the output is enabled.
07:49 PM enh: There must be a way to do it.
07:50 PM LeoNerd: I suspect the only real way to use the 9685 for servos is to just keep it programmed within that 1-2ms out of 20ms window
07:50 PM LeoNerd: Which loses you about 3 bits of resolution
07:52 PM enh: it leaves me with 205, out of 4096 steps
07:53 PM enh: I also tried to use the all led off option every 20ms, and disable the all led off in the beginning of the 2ms window, but it did not work as expected too
07:53 PM enh: The PWMs do not seem to start in sync
07:53 PM LeoNerd: There's a stagger-start option
07:53 PM enh: on 9685?
07:54 PM Lambda_Aurigae: if that is an LED driver, I wouldn't expect them to start in sync.
07:54 PM Lambda_Aurigae: out of sync gives you better power distribution it would seem.
07:54 PM enh: it is a led driver
07:55 PM LeoNerd: Oh, no this is the one that gives you programmable start and stop times
07:55 PM LeoNerd: Soyeah, surely you just program them all with the same start time?
07:59 PM enh: How to do that, LeoNerd?
08:00 PM enh: I saw nothing like that in the datasheet
08:00 PM LeoNerd: Program the start times
08:00 PM LeoNerd: The chip has registers for the start -and- stop time of every channel
08:00 PM LeoNerd: So just set all the starts to zero
08:00 PM enh: But they are not in sync
08:01 PM enh: There is nothing in the datasheet about the timing relations between PWMs
08:02 PM enh: I can set all to stop by setting ALL LED OFF bit 4 to 1.
08:02 PM LeoNerd: The separate ON and OFF registers
08:03 PM enh: If I set ALL LED OFF bit 4 back to 0, all PWMs restart, but not at the same time.
08:03 PM LeoNerd: What values have you got programmed into their ON time registers?
08:03 PM enh: all 0
08:04 PM enh: but they do not seem to be in sync
08:04 PM LeoNerd: Do you mean all the channels of one chip, or multiple chips?
08:04 PM enh: all channels in one chip
08:05 PM LeoNerd: I don't actually see mention in the datasheet about synchronising the counter with respect to the OE control
08:05 PM LeoNerd: In particular it doesn't say it'll zero and restart on that
08:05 PM enh: there is not any mention on that
08:05 PM enh: the is a sleep mode
08:05 PM LeoNerd: Yah; so possibly this won't work as a plan
08:05 PM enh: there*
08:06 PM enh: I haven't tried that yet
08:06 PM enh: sleep/restart
08:06 PM enh: but restart requires 500us to stabilize clock
08:07 PM enh: I do not know if restart restarts all in sync
08:09 PM enh: It says though, that the PWM update is done in the end of the off period
08:10 PM LeoNerd: That's the glitchfree value update part
08:11 PM enh: I could try to disable ALL LED OFF, update all PWMS, then re enable ALL LED OFF in less than a ms
08:13 PM enh: When I tried to open a 2ms window with OE, sometimes I did get two half periods inside the window
08:14 PM cehteh: why are you so focused on servo signals anyway, for multirotors no one useing the old 20ms signals anymore
08:14 PM LeoNerd: That sort of servo motor is dead-cheap to pick up though.. I have a bag of several of them
08:14 PM cehteh: just scrap the whole idea, redesign in a way that you can use more modern protocols as well
08:15 PM enh: 400 Hz servos are much simpler. Just set the frequency to 400hz
08:16 PM cehteh: are there tinys with 2x 16 bit timers?
08:16 PM enh: dunno
08:17 PM LeoNerd: I guessed the 1634 might, but nope even that doesn't
08:17 PM enh: two timers are needed?
08:17 PM LeoNerd: Oh.. the ATtiny841 has two 16bits
08:18 PM cehteh: i just have the idea to make standalone servo controllers, uart/i2c/spi whatever in and as much as possible channels out
08:18 PM LeoNerd: The 'tiny841 could do that then with 4 channels
08:18 PM cehteh: you certainly want 16bit to be flexible with each 2 comparators thats 4 channes from one such chip
08:19 PM cehteh: thats my thinking
08:21 PM cehteh: Timers
08:21 PM cehteh: 6 x 16-bit
08:21 PM cehteh: tiny417 :D
08:21 PM LeoNerd: Nice
08:22 PM enh: I wish I kenw enough to understand what you said
08:23 PM enh: knew*
08:23 PM Lambda_Aurigae: what's not to understand?
08:23 PM Lambda_Aurigae: or, rather, what don't you understand?
08:23 PM enh: how to make four channels with 2 16 bit timers
08:23 PM LeoNerd: Each timer has two compare outputs
08:23 PM Lambda_Aurigae: two pwm compare points on each timer
08:24 PM enh: compare = overflow?
08:24 PM Lambda_Aurigae: OCRA, OCRB
08:24 PM enh: ah, ok
08:25 PM enh: sorry
08:25 PM enh: each OCR triggers an interrupt?
08:25 PM cehteh: flip the output
08:27 PM cehteh: but .. problem: with all your controllers it has considerable overhead to pass the data around
08:27 PM * enh opens the atmega328p datasheet
08:27 PM Lambda_Aurigae: you set the speed of the timer...then set the output compares for the timer.....then each one toggles at its set point.
08:27 PM Lambda_Aurigae: you can set different pulse widths for the two outputs.
08:27 PM Lambda_Aurigae: but the frequency of the two matches.
08:27 PM enh: ah, ok
08:28 PM enh: thanks
08:28 PM Lambda_Aurigae: that's the simplified version.
08:28 PM cehteh: so you set prescaler and TOP to have 20ms timespan
08:28 PM cehteh: and the OCRx to generate whatever signal/duty cycle you want
08:29 PM cehteh: your pwm generation runs completely in hardware, no interupts etc
08:30 PM cehteh: you can use the mpu for doing the communication and math, and maybe a interrupt to latch new values into the PWM's without stopping/glitching
08:30 PM cehteh: thats rather simple and straightforward
08:30 PM Lambda_Aurigae: I've done 16 hobby servos on a single atmega32 without any timers but that took a lot of processor time and such.
08:30 PM cehteh: prolly glitched as well
08:31 PM Lambda_Aurigae: didn't have any problems with glitches as I didn't do much of anything else on the chip beyond input via usart
08:31 PM cehteh: you can do that in software, but then handling incoming data on serial becomes more pain
08:32 PM cehteh: glitching as in having slight jitter on the outputs/timing
08:32 PM enh: I guess so. Communiction can interrupt your counters at undesireable times
08:32 PM Lambda_Aurigae: was sending simple 18 bytes of data over hardware usart and didn't have any issues that were noticeable.
08:32 PM cehteh: prolly not noticeable on a normal servo, they have too much deadband anyway
08:32 PM Lambda_Aurigae: these were cheap hobby servos.
08:32 PM cehteh: yes
08:33 PM Lambda_Aurigae: used it for making a 6 legged walker.
08:33 PM cehteh: but with what i suggested, to use more modern protocols for the outputs it stretches the limits .. much much shorter timing
08:33 PM Lambda_Aurigae: yup.
08:33 PM Lambda_Aurigae: this was also,,,10 years ago.
08:33 PM cehteh: i dont even know if thats possible with a AVR 16 bit timer (multishot or whatever)
08:33 PM cehteh: just do the math first
08:34 PM Lambda_Aurigae: yeah.
08:34 PM cehteh: 20mhz prescaler/1
08:34 PM Lambda_Aurigae: I would do it with an attiny per servo these days.
08:35 PM enh: intelligent servos
08:35 PM Lambda_Aurigae: pretty much.
08:35 PM cehteh: same here
08:35 PM enh: how would you talk to them?
08:35 PM _ami_: attiny13a would be a good choice?
08:36 PM Lambda_Aurigae: i2c
08:36 PM Lambda_Aurigae: do it on an i2c bus.
08:36 PM cehteh: or usi with some homegrown lowlevel protocol
08:36 PM _ami_: oh, i2c is not present on t13a? i2c slave in software in hard
08:37 PM _ami_: 1 pin communication protocol like DHT22/11 does can be a good option.
08:37 PM cehteh: just bang data + checksum into it ... you want 10bit resolution, send 16bit (2x8) with the upper 6 bit as checksum
08:37 PM cehteh: or maybe servo address + checksum
08:38 PM cehteh: 2-3 bit servo address .. you dont want to control more than 4-8 servos with a single tiny anyway
08:38 PM cehteh: or global servo addresses .. 5 bit, one bit parity, i am thinking too much :)
08:40 PM enh: 4 wires to the servo? gnd, 5V, clk and data
08:41 PM Lambda_Aurigae: hmmm...wonder if the attiny85 series usi can do 9 bit uart
08:41 PM LeoNerd: You can with a bit of effort
08:42 PM LeoNerd: Though any form of UART on the USI has the trouble that the bits are in the wrong order
08:42 PM LeoNerd: USI is made for I²C or SPI, so it works MSB-first. UARTs usually go LSB-first
08:42 PM Lambda_Aurigae: so long as you know the order you can work with it.
08:43 PM Lambda_Aurigae: can do an spi-ish comms too..
08:43 PM cehteh: USI would be really univeral if they added a bit somewhere to define the shift direction
08:43 PM cehteh: guess thats too much to wish for
08:43 PM LeoNerd: That would have been good, yeah
08:43 PM LeoNerd: But there's literally not a single spare bit, so it would need a new control register
08:44 PM cehteh: also silicon for implementing it
08:44 PM Lambda_Aurigae: one could pretty easily setup a comms net...so you send data 7 bits instead of 8...2 bytes for 14bit resolution.
08:44 PM Lambda_Aurigae: the 8th bit is address/data selector.
08:44 PM LeoNerd: You can do 9bit prettymuch as easily as 8bit on them
08:45 PM LeoNerd: I didn't say you can't; I mean that any UART is already kinda awkward on the USI, so doing 9 bits instead of 8 isn't any worse
08:46 PM Lambda_Aurigae: many ways to skin the cat of getting data on a bus to multiple attiny chips though.
08:47 PM cehteh: as saied 10 bits data, 5bits address, one bit parity (or 4/2 .. or use 9bit transfers for parity etc)
08:47 PM cehteh: all servos listen on the same bus
08:47 PM LeoNerd: I don't think I've ever bothered with the USI for UART; whenever I've needed a UART on a small tiny, I just bitbang it directly on some pins
08:47 PM cehteh: if parity mismatches it may resync (may have picked the odd out of sync byte)
08:48 PM cehteh: iirc there where tinys with uart
08:48 PM LeoNerd: There are a few, sure
08:48 PM LeoNerd: tiny841 for example
08:50 PM enh: https://hackaday.io/project/10071-intelliservo
09:03 PM enh: is the i2c repeater really necessary?
11:44 PM LiaoTao: enick_976: "And just in case they needed to be far apart it would always be possible to add a pair of P82B715 repeater boards between servos, which boost the distance to approximately 50 meters or 3000 pF"
11:44 PM LiaoTao: Sorry enick_976
11:44 PM LiaoTao: enh left