#avr Logs

Mar 06 2017

#avr Calendar

01:49 AM pitastrudl: rue_house, yes that i know, thank you
02:21 AM tkoskine_ is now known as tkoskine
03:12 AM inductiv- is now known as inductiveload
04:46 AM Jan-: hihi avr people
04:47 AM Jan-: if I were to use the adc in an avr to measure battery voltages, assuming I wanted to use the high-precision reference, would that mean I'd need to divide down my battery voltages to a level lower than the ADC reference, or does it stay at 0-5v range?
05:28 AM LeoNerd: Jan-: The usual strategy is to measure the reference on an ADC input, by using main VCC as the ADC's reference
05:29 AM LeoNerd: That's why most of the AVR chips have an ADMUX setting to measure the onboard 1.1V ref
05:29 AM Jan-: oh, then calibrate it
05:29 AM Jan-: hmm
05:29 AM Jan-: okays.
05:29 AM LeoNerd: I usually find the internal reference quite accurate enough for measuring a battery
05:30 AM Jan-: I just thought if we divided the battery down to <1.2v it would be quite noisy.
05:30 AM LeoNerd: Well also if you use any sort of voltage divider on the battery, that'll probably be permanently connected so will leak lots of current
05:31 AM Jan-: well yes.
05:31 AM Jan-: but we're gonna have to do that one way or the other
05:31 AM Jan-: can't measure a 16.8V battery
05:31 AM Jan-: maybe disconnect with fets
05:31 AM LeoNerd: Ah :)
05:32 AM LeoNerd: I was presuming the battery was directly on VCC; e.g. some sort of 3.{mumble}V lithium thing
05:32 AM LeoNerd: Most of my battery things are 3.3V LiFePO4 cells
05:33 AM Jan-: this is a battery pack for movie cameras.
05:33 AM Jan-: we're tired of paying $600 for them :)
05:34 AM Jan-: I just have to write a battery discharge modelling thing in AVR C :/
05:34 AM * Jan- is a bit alarmed by this prospect
06:33 AM specing: paying $600 for what
06:33 AM specing: Jan-: See ATAVRBC100 devkit
06:53 AM Jan-: specing: Batteries comprising eight 18560 lithium ion cells.
06:53 AM Jan-: and yes I have looked at the battery-specific AVR stuff but there's an advantage in using something where we can buy little USB dev boards for $2.
07:53 AM specing: Jan-: $600 FOR THAT?!
07:53 AM specing: Jan-: the best 18650 capacity-wise is 5 eur
07:55 AM Lambda_Aurigae: little usb dev boards for $2.00...guessing chinese knockoff ardweeny boards...those are great for play but for serious work I would not trust them any further than I could launch them with a desktop trebuchet.
07:59 AM specing: so you'd rather pay a premium for someone in the west to sell you a chinese knockoff ardweeny board?
08:04 AM Ad0: hm what do I do if sck is shared with adc1 and the "SCK" of the same pin is connected to a PI gpio? can I somehow disengage the GPIO properly without needing some switching transistor?
08:05 AM Ad0: (attiny85)
08:06 AM Ad0: if the GPIO remains connected it screws up the ADC of course
08:09 AM gjm: geg
08:14 AM Lambda_Aurigae: specing, I just don't buy anything ardweeny myself..
08:21 AM Jan-: specing: Srsly.
08:21 AM Jan-: https://www.bhphotovideo.com/c/product/610983-REG/Anton_Bauer_DIONIC_HC_DIONIC_HC_Lithium_Ion_Battery.html
08:21 AM Jan-: Mainly we wanted to create a little thing using (maybe) bluetooth or nrf radio modems, so we could have a box in your pocket which would vibrate when one of your batteries was going flat.
08:22 AM Jan-: sadly to do that I need to write a whole battery discharge modeling thing and we have to build a current meter :/
08:25 AM specing: lmao
08:25 AM specing: Jan-: what is that battery for?
08:26 AM specing: you don't need a current meter. just measure voltage sag
08:26 AM Jan-: to be honest I'd sort of come to that conclusion.
08:26 AM Jan-: they're used for film and TV cameras and lighting equipment.
08:27 AM Jan-: I'm not sure how worthwhile it'd be to actually make a full coulomb counter, given that lithum ion batteries have quite a large voltage swing.
09:29 AM rue_house: it looks like a 16500 case
09:30 AM rue_house: $500 is a bit steep for me
09:30 AM * rue_house stacks more lemonjuice and zink into a tube...
09:32 AM Jan-: yeah well
09:32 AM Jan-: the only issue is that they have to go through a lot of regulatory approval, if you want to take them on airplanes.
09:32 AM Jan-: okays well I have to go thanks for chattin all
09:44 AM rue_house: I wonder how many unregulated batteries are in north america
10:03 AM Chillum: legally unregulated, or electrically unregulated?
11:31 AM hetii: Hello :)
11:36 AM bss36504: Howdy
11:40 AM hetii: Anyone play with ambilight system and hyperion project ?
11:59 AM Emil: rue_house: wtf is a unregulated battery
12:01 PM antto: a naughty battery
12:22 PM Emil: illegal immg^d^d^d^dbatteries
12:53 PM hetii: driving ws2812b is painful :/
12:54 PM hetii: at least when need to do something else ...
12:55 PM bss36504: hetii: can you not leverage some sort of peripheral? I assume you're bitbanging the whole thing
12:57 PM hetii: yep I use atmega8 with some asm code that keep care about timming, but I need also be able to exchange data over uart as well as receive IR commands
12:58 PM bss36504: Could you use a spi port to do the actual data transfer to the LEDs?
12:58 PM hetii: by SPI you mean real spi communication or just some hack that use spi hardware to keep timming ?
12:59 PM bss36504: The latter
01:00 PM hetii: well general my plan was to use SPI to talk with nr24l01 but currently I use it to send IR data by using OC2 output
01:00 PM hetii: so I guess I can also change again idea and use it just to drive my leds if its help
01:00 PM bss36504: could you perhaps farm the whole LED thing out to another micro and talk at it using I2C or SPI or something?
01:00 PM bss36504: Maybe just an Attiny
01:01 PM bss36504: either way it sounds like you're trying to do too many things in not enough clock cycles on the mega 8. So either farm out the LEDs, since they are unnecessarily CPU intensive, or buy a faster micro. Those are my initial thoughts
01:02 PM hetii: yep, its a bit frustrating cause I done already all hardware things :/
01:03 PM bss36504: Oh like your boards are built already?
01:05 PM bss36504: You'd think with the popularity of the WS2812 that there would be a driver chip for it. Talk SPI in one end, it talks to LEDs on the other. You could even have such a driver manage 2D arrays of LEDs with built in bitmap RAM and whatnot
01:05 PM bss36504: Like an LCD driver
01:05 PM hetii: yep this is how its look now: uhttps://snag.gy/TLaUvZ.jpg
01:05 PM bss36504: Is that a recycled ATX power supply case?
01:06 PM hetii: yes, I put there ATX psu + odroid xu4 + my board to drive regular RGB leds + ws2812b and have radio link + infrared
01:08 PM bss36504: can we just appreciate the irony of having a quad core SBC in the system and yet you are struggling with LED timing?
01:08 PM bss36504: :)
01:09 PM bss36504: I mean that in good fun
01:09 PM hetii: hehe yep :)
01:10 PM hetii: also small issue have with hyperion project, they drop support for uart bridge, or at least they claim that it works unstable and other solution based on raspberry pi hardware or by using usb transmission
01:11 PM hetii: for eg there is some fork of usbasp that is used a bridge to control ws leds
01:12 PM hetii: so somehow they handle usb timming and leds
01:12 PM Lambda_Aurigae: and pretty much nothing else.
01:13 PM Lambda_Aurigae: and run it at 20MHz on an atmega88 or something like that too I bet.
01:13 PM foubarre: Hello. It seems i have bricked an atmega32u4, by setting a wrong xtal type. it stopped responding at reset and cannot be flashed anymore. Do you have any hint?
01:13 PM bss36504: can you just use a UART to control the LEDs?
01:13 PM Lambda_Aurigae: foubarre, two options
01:13 PM bss36504: foubarre: Can you provide a clock signal to the CLKIN pin?
01:13 PM Lambda_Aurigae: option 1, HVPP
01:13 PM Lambda_Aurigae: option 2, external clock source to xtal1 pin
01:16 PM hetii: bss36504, well currently I have uart link from odroid to my atmega and i`m able to drive my leds, but cannot do anything else
01:16 PM hetii: :/
01:17 PM foubarre: aww. ok. Will be too much hassle. I will unsolder it and fit an other one. Thanks a lot. In any case, thanks for the solutions. If i ever need to, i'll know how to do.
01:19 PM hetii: but maybe I could use hardware interrupter that will cath that I need to receive some IR command and then disable for a while driving my leds but m
01:20 PM bss36504: yeah seems like a tough thing to solve without rebuilding the hardware
01:21 PM Lambda_Aurigae: hetii, not sure how your code is setup now but you could make everything interrupt driven.
01:23 PM hetii: My main: http://paste.ubuntu.com/24126252/ and ws2812b: http://paste.ubuntu.com/24126253/
01:28 PM Lambda_Aurigae: mega8 running at 16MHz should handle all that just fine. Not sure how your uart code is setup though. Is it interrupt based or polling/blocking?
01:29 PM hetii: uart: http://paste.ubuntu.com/24126276/
01:31 PM Lambda_Aurigae: definitely not interrupt based.
01:31 PM Lambda_Aurigae: so that blocks and waits for data.
01:31 PM hetii: as far as I tested was able to exchange data by using 2M baudrate, but hyperion handle max 1M
01:31 PM Lambda_Aurigae: that will suck a lot of your processor time doing nothing.
01:32 PM Lambda_Aurigae: and a soft uart too,,,so it takes even more processor time.
01:33 PM hetii: soft uart is there just for testing and maybe will use that uart stuff somewhere else.
01:33 PM hetii: but its not important now.
01:33 PM hetii: I think the main issue is with ws driver.
01:34 PM hetii: If I disable interrupts there while sending data nothing will work that use interrupt
01:34 PM Lambda_Aurigae: yup.
01:35 PM Lambda_Aurigae: I would rework the whole thing from the ground up myself so as to use the processor to its best advantage.
01:36 PM julius: rue_house, highlight of the day: 0 chips died today by my hands
01:36 PM Lambda_Aurigae: julius, try HARDER!
01:36 PM hetii: Lambda_Aurigae, well do you think its doable to handle ws leds and have all other type of communication ?
01:37 PM Lambda_Aurigae: sure.
01:37 PM Lambda_Aurigae: you are running that at 16MHz, yes?
01:37 PM hetii: yep
01:37 PM Lambda_Aurigae: that thing should more than handle it.
01:37 PM Lambda_Aurigae: but you have to do it without blocking code.
01:37 PM Lambda_Aurigae: right down to and including the led driver.
01:39 PM hetii: ok I will think a bit about it and check what will be possible or at least what I be able to do
01:39 PM Lambda_Aurigae: not sure what is needed for that led driver
01:39 PM Lambda_Aurigae: but I can't imagine it is too intense.
01:39 PM hetii: cause I don`t want to rebuild everything, things like irmp project I want to use without much changes.
01:40 PM julius: Lambda_Aurigae, you are right :)
01:41 PM hetii: well ... https://github.com/FastLED/FastLED/wiki/Interrupt-problems
01:44 PM Lambda_Aurigae: how many LEDs in your strip?
01:45 PM hetii: 155
01:46 PM bss36504: If I were you and I wanted to stick to AVR8, I'd re build the board to include a co-processor to handle the LEDs.
01:49 PM hetii: well probably I could add attiny and as I use already two NAND gates as a buffer I could split input of first gate and one input connect to my attiny and second input to my atmega, by this way I should be able to control my strip by atmega as well as by ttiny :)
01:49 PM hetii: but this is small workaroung :)
01:49 PM hetii: *d
01:50 PM hetii: The point here is in that I want to control those leds also when my adroid is off :)
01:51 PM hetii: so use them with some static effects
01:51 PM Lambda_Aurigae: so, you have to stream all 155 24bit triplets in one go it seems.
01:52 PM Lambda_Aurigae: that could cause some issues with other interrupts trying to run.
01:52 PM Lambda_Aurigae: 4650 ns
01:55 PM Lambda_Aurigae: unless you could use a timer to generate the data stream...it would have to be a very naked interrupt routine though.
01:55 PM Lambda_Aurigae: I would almost start with that then add other things to it.
01:56 PM Lambda_Aurigae: ultimately it looks like an attiny playing led driver would be the best bet.
01:57 PM Lambda_Aurigae: I still think the atmega8 at 16MHz should handle it with the right software.
01:59 PM hetii: yep, but the question is how much time I spend to figure it out to be the right :)
01:59 PM hetii: instead using additional mcu :)
01:59 PM Lambda_Aurigae: yup.
02:01 PM hetii: Ok other question I have amplifer that use such MCU: http://www.datasheetspdf.com/datasheet/CR80P200.html
02:01 PM hetii: I lost remote controller for it,
02:02 PM hetii: Any chance to discover what kind of infrared protocol was used to control it
02:03 PM Thrashbarg_ is now known as Thrashbarg
02:20 PM Ad0: nice with some MISO soup
02:38 PM Lambda_Aurigae: would need more info on the amplifier itself.
03:55 PM cousteau`: On an AtMega328, is it NOT possible to set both period and duty cycle on OC0A and OC2A PWM pins?
03:55 PM cousteau`: (And on OC1A I could do it by manually loading a value on ICR1, iiuc)
03:59 PM cousteau`: Brb, joining on an IRC client that won't disconnect after 3 minutes
04:01 PM Emil: cousteau`: yeah, it's limited to either frequency or duty cycle
04:01 PM cousteau: I see, that's what I understood from the datasheet
04:02 PM Emil: That's on all AVRs, really
04:02 PM Emil: On the newer atmega328pb you do have a modulation possibility for (one?) of the pins
04:02 PM cousteau: But for OCxB I can just use both comparators
04:04 PM cousteau: IIUC that has always been possible, you can set OCxB to 0 when the counter reaches OCRxB, and reset the counter (and set OCxB to 1) when it reaches OCxA
04:05 PM Emil: That's quite the manual intervention
04:05 PM Emil: but yeah it is possible like that, of course
04:05 PM cousteau: I thought it was what you were supposed to do
04:07 PM cousteau: And for OC1A you can use ICR1 as the max count. Now THAT is hacky. :)
04:07 PM cousteau: OK, thanks for confirming it! Gotta go.
04:10 PM Emil: np
04:20 PM julius: how do you adjust a constant current source that is already set to 9v? when i connect my meter to the output ports and measure in the max 10a range the green led on the current board goes dark and i also saw a nice spark...probably beause my probe lost contact for a second
04:24 PM Lambda_Aurigae: julius, depends on the source...and whether you are adjusting voltage or current.
04:26 PM julius: need 9v for the led at 900ma
04:27 PM julius: the source is a really cheap china converter getting its input from a old laptop power supply
04:28 PM julius: http://i-makers.info/resource/XL4015%20datasheet.pdf
04:28 PM julius: thats the chip on it
04:30 PM Lambda_Aurigae: yeah,,,I'm at work doing training...not reading your datasheet to teach you how to read a datasheet...sorry.
04:32 PM julius: of course not
04:32 PM julius: sorry, didnt want to make you read it
04:32 PM julius: the good news is it got a short circuit protection
04:36 PM Lambda_Aurigae: my point being, asking how to adjust something without us knowing what it is you are adjusting is like calling your doctor and saying "it hurts when I do this." and not saying what "it" or "this" is.
05:04 PM julius: ah ok
05:05 PM julius: turns out that the variable resistor for current was "overdriven/damaged" and the resistance was always around 0ohm so the current couldnt change
05:06 PM julius: i was worried about how much resistance my meter provides in the 10A current range, if it would look like a small resistor to the current source it would trip the over current protection
05:07 PM julius: so i guess i better get a 10ohm 10w resistor and put it in series like this: current source output + -> resistor -> meter -> source output -
05:09 PM julius: that should provide a maximum of 900ma of current depending on the setting of the source - which would result in a measureable current
05:12 PM julius: if one would only change the current the voltage would be: v=r*i, but since the voltage for the led needs to be between 9 and 12v i did set the source to 9v....but if im changing the current setting at the same time and the load has a fixed resistance...how does the current/voltage source provide both a constant current and a constant voltage?
05:22 PM arij is now known as arij_work
06:51 PM Jan-: hihi
06:51 PM Jan-: why doesn't this channel have two #s
06:51 PM rue_bed: because we dunt follow rules
06:51 PM LeoNerd: A curiously fun question
06:51 PM rue_bed: it is a channel from before time when there was only one #
06:53 PM Jan-: teehee
06:53 PM Jan-: So um.
06:53 PM Jan-: If I have an AVR read the voltage of some lithium-ion cells, maybe using transistors to switch the dividers in and out because it's a four-cell stack, could I write some code so that it would learn roughly what the time-to-discharge was?#
06:54 PM Jan-: I'm thinking observe how fast it decreased by X, take into account the actual value of X because the discharge curve is nonlinear, then estimate.
06:54 PM rue_bed: so if i had a kalman filter on a camera, and I take a really attenuating object with a light behind it, and take images with the light on and off, do you think the filter can see thru the object?
06:54 PM Jan-: Maybe you'd have to let it watch the battery discharge a few times, then you could build up a lookup of the voltages.
06:55 PM specing: Jan-: HJK already did that
06:55 PM Jan-: who
06:55 PM specing: http://lygte-info.dk/review/batteries2012/Common18650comparator.php
06:56 PM Jan-: oh.
06:56 PM Jan-: well, my approach would be to have it learn, anyway.
06:56 PM Jan-: then you could take into account the fact that the battery's performance would drop off as it aged.
06:57 PM Jan-: I guess the question is whether that whole approach is likely to be even nearly accurate.
06:58 PM Jan-: I guess it wouldn't work so well for nicd
07:01 PM specing: nobody cares about nicd anymore
07:01 PM Jan-: They do if they want to homebuild batteries and take them on airplanes.
07:02 PM specing: additionally, the sale of NiCD batteries is banned in the EU
07:04 PM Jan-: Er... really? We recelled some nicd camera batteries in November.
07:06 PM specing: http://www.batteryrecycling.org.au/eu-ban-on-nicd-batteries-for-power-tools
07:07 PM Jan-: Well, I don't know what to tell you. Cells are apparently still available.
07:08 PM Jan-: I wonder if there's an exception for some situation we're in.
07:08 PM specing: from where?
07:08 PM Jan-: http://batteriesplus.co.uk/acatalog/1.2V_NiCd_Sub_C_Rechargeable_Tagged_Batteries.html
07:08 PM Jan-: oh well
07:08 PM Jan-: brexit :D
07:13 PM specing: well, considering I can get a 18650 at that price point that contains 12 times more energy...
07:13 PM Jan-: we have used them, they're a bit of a pain
07:13 PM Jan-: they're very easy to damage
07:13 PM specing: not really
07:13 PM specing: you just need protection circuitry
07:41 PM Jan-: we have tried some of the available board for protection
07:41 PM Jan-: a common problem is that they allow the batteries to discharge too low.
07:42 PM Jan-: okay, they're the cruddy chinese ones, but there's not much choice really
07:43 PM Jan-: the texas instruments BQ series do a lot of things, but they're kinda complicated to use. You have to buy a development board, and for some of them there's special PC software to run so it can learn the battery characteristics. AND then you have to do a PCB for some tiny BGA or TSSOP chip, which we can't really do.
07:43 PM Jan-: So... AVR to the rescue!
07:45 PM Jan-: I think the chips the chinese boards use are by Seiko, or clones of them, but they seem to discharge down to 2.8V which we think is too low
10:53 PM daey_ is now known as daey
11:42 PM daey_ is now known as daey