#avr Logs

Oct 14 2019

#avr Calendar

12:45 AM polprog: ive got a nice, fully analog danfoss relay and pump controller
12:50 AM polprog: drives 4 relays based on the front panel settings and a 4-20mA reading from sensors
12:50 AM polprog: lm324 everywhere
01:03 AM Thrashbarg_ is now known as Thrashbarg
01:06 AM rue_mohr: k
01:06 AM rue_mohr: 324 is my fav. not-rail-to-rail amp
02:12 AM Thrashbarg: the 324 is my least favourite :P
02:13 AM Thrashbarg: crossover distortion, poor slew rate
02:14 AM Thrashbarg: also being a quad op-amp device it makes it a little more tricky to cram components around it
02:14 AM Thrashbarg: easier with a dual op-amp
02:17 AM rue_mohr: what about TL084
02:17 AM rue_mohr: you only need 4V of headroom from your signal to your supply rails
02:17 AM Thrashbarg: heh
02:38 AM rue_mohr: well I suppose its better than a vacuum tube
02:39 AM rue_mohr: w/ extra 35? V to signal head?
03:35 AM rue_bed: if I'm using an avr at 16Mhz to measure the phase time of two 40kHz waves, whats my resolution?
03:36 AM rue_bed: :S 0.9 degrees
03:36 AM rue_bed: so, why would a 1khz measurement be flapping by 4 degrees????
03:37 AM rue_bed: it should be good to less than 0.1 degrees
03:37 AM rue_bed: hmmmmm
04:16 AM polprog: bad machine code?
05:29 AM jmorris_ is now known as jmorris
12:01 PM kline is now known as koboldline
12:59 PM rue_mohr: could be hardware too, dunno
01:00 PM polprog: no, i was thinking like some accidental overhead and the like
01:01 PM nohit: which avr btw ?
01:02 PM nohit: why you are using avrs for this anyways
01:04 PM polprog: rue and his 1-wire 595 black magic, why would he use a CPU if he can put that together with diodes and caps :D
01:04 PM nohit: :D
01:30 PM mouseghost: hi, do you write your own drivers for sd card/fat32?
01:30 PM rue_shop2: eeek too many layers and potholes
01:34 PM Fuchikoma: You'd have to be fairly desperate to do that
01:35 PM mouseghost: well what do you do
01:36 PM rue_shop2: fairly desperate or REALLY fed up with all the bugs etc with everyone elses code
01:36 PM Fuchikoma: I've never done a project that used an SD card or delt with FAT but I'd probably use a library someone else already wrote
01:36 PM mouseghost: ahm
01:36 PM mouseghost: Fuchikoma, did you save data somehow?
01:36 PM rue_shop2: hmmm my phase angle is all wrong...
01:42 PM rue_mohr: / phase angle is pt/tt * 360
01:43 PM rue_mohr: I'm the wrong direction and offset by 180 degrees
01:48 PM Fuchikoma: On the few occasions I ever needed to save data between power-ups, I just write it to the EEPROM
01:50 PM julius: just wrote my first few bytes to a sdcard :)
01:51 PM mouseghost: julius, with a filesystem? did you use some kind of library?
02:00 PM Fuchikoma: You can just write data to it however you want
02:01 PM Fuchikoma: The card itself does not manage the file system, so you're free to make up your own data storage scheme
02:01 PM Fuchikoma: ...just don't expect that card to be readable by anything else
02:01 PM mouseghost: well yeah ive found that out
02:01 PM mouseghost: though i think ive decided to just use eeprom
02:02 PM Fuchikoma: If it's only a few doezens of bytes you need, that's a perfectly valid option and pretty much exactly what the EEPROM is for
02:02 PM Fuchikoma: Unless you're changing it a lot, then maybe it's not optimal
02:03 PM mouseghost: well then ok i might use sd card...
02:03 PM mouseghost: uh im so undecided
02:03 PM Fuchikoma: IIRC it's rated for 100K cycles, so if you're storing log data or something that's updating on a sec-by-second basis that's not a good idea
02:04 PM mouseghost: well yes ive meant logs
02:04 PM Fuchikoma: How much data?
02:04 PM mouseghost: few bytes a time, i dont know yet
02:04 PM Fuchikoma: hmm
02:04 PM mouseghost: Fuchikoma, i mean, if hte interface is similar then why should i even choose
02:05 PM mouseghost: though ive had bad luck finding about sd cards
02:05 PM julius: mouseghost, https://www.arduino.cc/en/Tutorial/Datalogger i think its ok to use arduino to get your feet wet
02:05 PM julius: mouseghost, no you dindnt have bad luck
02:05 PM julius: mouseghost, avr guys are just not very smart when it comes to writing documentation about sdcards....people in this channel are excluded
02:05 PM mouseghost: :/
02:05 PM Fuchikoma: :p
02:06 PM Fuchikoma: It boils down to how much data you're storing and how often you're saving data
02:07 PM rue_mohr: ok I know what it is, my phase detectors are out by 4 degrees
02:07 PM mouseghost: say, 4 bytes a second
02:07 PM mouseghost: continously
02:07 PM Fuchikoma: okay
02:07 PM Fuchikoma: For how many seconds?
02:07 PM mouseghost: loooooong
02:07 PM mouseghost: Fuchikoma, i want to make a temperature measuring thing
02:07 PM Fuchikoma: Well at soem point you'll probably want to extract the data
02:08 PM julius: mouseghost, im currently making that
02:08 PM mouseghost: :D
02:08 PM Fuchikoma: So how long between data downloads?
02:08 PM mouseghost: what a coincidence
02:08 PM mouseghost: Fuchikoma, a month?
02:08 PM Fuchikoma: A good place to start
02:08 PM mouseghost: i would go for a year but thats unrealistic
02:08 PM mouseghost: oh its not that unrealistic
02:08 PM julius: mouseghost, i got some code for the ds18b20 temp sensor
02:08 PM mouseghost: seems like 130MB
02:09 PM mouseghost: julius, well, i can code that especially when there are some sane reference sheets
02:09 PM Fuchikoma: So one month (31 days) is 2,678,400 seconds, times 4 bytes is 10,713,600 bytes
02:09 PM julius: cehteh, thanks for the serial driver links
02:10 PM mouseghost: Fuchikoma, 10MB, 120MB for a year
02:10 PM Fuchikoma: right
02:10 PM mouseghost: i mean, i thought these were much higher values
02:10 PM Fuchikoma: BUT
02:10 PM Fuchikoma: You may or may not want timestamps or other serialization info with that data, so let's say at least double that
02:10 PM mouseghost: well, i included the timestamp
02:10 PM mouseghost: 1 byte
02:10 PM mouseghost: oh sorry that doesnt fit
02:10 PM mouseghost: -w-
02:11 PM Fuchikoma: That's not much of a timestamp for per-second resolution
02:11 PM mouseghost: messed up my resolutions
02:11 PM mouseghost: yeah i should also recheck what does that temp sensor output
02:12 PM mouseghost: so 2 bytes for temp
02:12 PM Fuchikoma: Anyway, a 512Mb (64MB) NAND flash chip will cost you under US$2
02:13 PM mouseghost: Fuchikoma, NAND flash chip=EEPROM?
02:13 PM Fuchikoma: I'm looking at a 1Gb (128MB) chip that's US$2.25 on Mouser
02:14 PM Fuchikoma: No, it's Flash. The write cycles are comparable though
02:14 PM mouseghost: uhh... whats the difference?
02:14 PM Fuchikoma: But write cycles only conut per bit; If you're not writing to the same bits over and over, it doesn't count as a cycle
02:15 PM mouseghost: Fuchikoma, the thing is that i also need a way to access these values
02:15 PM Fuchikoma: All Flash is EEPROM but not all EEPROM is Flash
02:15 PM mouseghost: ah
02:15 PM Fuchikoma: Sure you can do that through your microcontroller as well
02:16 PM mouseghost: and what, output through some usb connection?
02:16 PM Fuchikoma: USB or standard serial port yeah
02:16 PM mouseghost: wont that overcomplicate things where i can just write to sd card with the same interface and then get that card out and read it with hxd or something
02:16 PM Fuchikoma: Well
02:17 PM Fuchikoma: It's a tradeoff; To use an SD card, you need to put the complexity into the programming to support FAT32
02:18 PM Fuchikoma: Or you can trade that program compelxity for user interface complexity; Having to connect a serial cable and download the data
02:18 PM Fuchikoma: (Or Wireless, or IR)
02:24 PM rue_mohr: or make a seperate avr to handle it via a simpler protocol
02:25 PM PoppaVic: should be able to do block r/w w/o most of the FAT
02:29 PM Fuchikoma: rue: I mean, it doesn't get much simpler than dumping the contents out through a serial port
02:30 PM rue_mohr: capturing it back can
02:30 PM Fuchikoma: Not sure what you mean
02:30 PM rue_mohr: there is a particular tidyness about being able to pull the sd card and put it into a computer
02:30 PM Fuchikoma: Oh absolutely
02:30 PM rue_mohr: doubleclick log.csv
02:31 PM rue_mohr: oh wait, Apple determined files are obsolete
02:31 PM Fuchikoma: But that tidyness comes at a cost of having to program your device for managing FAT32
02:31 PM rue_mohr: totally
02:31 PM rue_mohr: I'v not successfully pulled off SD card access
02:32 PM Fuchikoma: It shouldn't be a HUGE cost if you find a good library
02:32 PM rue_mohr: either because of SD card protocol issues or signal level issues
02:32 PM rue_mohr: there are like 4 different SD card protocols
02:32 PM rue_mohr: and iirc each of them break into 4 subprotocols
02:32 PM rue_mohr: with every manufacturer supporting a different set of features
02:32 PM Fuchikoma: Right so, the other way is to sacrifice tidiness for programming ease; Have the end user use a serial protocol
02:33 PM Fuchikoma: Heh, here's a thought; Split the difference, use multiple serial flash chips and a custom reader
02:33 PM Fuchikoma: Fuck it
02:34 PM Fuchikoma: You just invented your own memory cart format :D
02:37 PM rue_mohr: kermit
02:38 PM rue_mohr: I wonder what tftp looks like under the hood
02:38 PM rue_mohr: tftp over pptp
02:38 PM rue_mohr: er sorry
02:38 PM rue_mohr: tftp over ppp
02:39 PM rue_mohr: or for that matter just use http
02:40 PM Fuchikoma: Now you're putting a web server in your project?
02:40 PM rue_mohr: no
02:40 PM rue_mohr: just something that walks and talks like a http service enough to get your data
02:40 PM mouseghost: Fuchikoma, cant i just dump data to the sd card?
02:40 PM mouseghost: without a filesystem?
02:41 PM rue_mohr: you can if you dont want to use windows to access it
02:41 PM Fuchikoma: ^
02:41 PM mouseghost: theres hxd...
02:41 PM Fuchikoma: Still won't work
02:41 PM mouseghost: will windows say 'f... u' if i try to read binary sd card?
02:41 PM Fuchikoma: Windows won't even acknowledge the card exists
02:41 PM rue_mohr: cmon, ppp cant be that hard to do on an avr
02:41 PM mouseghost: ;-;
02:41 PM rue_mohr: could it?
02:41 PM rue_mohr: uncompressed
02:42 PM Fuchikoma: You COULD make your own device to read the cards as well
02:42 PM mouseghost: or just use linux
02:42 PM Fuchikoma: So now you're makign two devices; the logger, and a card reader
02:42 PM mouseghost: i could do read over serial and interface too with storage in sdcard
02:43 PM mouseghost: 47,09 zł for 1Gb...
02:43 PM * mouseghost faints
02:43 PM Fuchikoma: I don't know what currency that is
02:44 PM mouseghost: Fuchikoma, PLN
02:44 PM Fuchikoma: Aha
02:44 PM rue_mohr: an esp8266 can be a network bridge
02:44 PM mouseghost: yes, access temperature logs over a serial wifi
02:44 PM rue_mohr: it looks like nobody makes a wired version of an 8266 :(
02:45 PM mouseghost: with a dedicated app for your iphone
02:45 PM rue_mohr: http
02:46 PM Fuchikoma: Internet of things!
02:46 PM mouseghost: well, serial seems fair, but i want it to store on sd card
02:47 PM Fuchikoma: So start looking around for and experimenting with SD card/FAT32 libraries
02:47 PM Fuchikoma: Someone linked an Arduino project earlier, start there maybe
02:48 PM mouseghost: it didnt say about low level interface, did it
02:48 PM Fuchikoma: "Low level interface" ?
02:50 PM mouseghost: Fuchikoma, i mean, it looked like sdcard.write or something
02:50 PM Fuchikoma: Yeah and?
02:50 PM mouseghost: Fuchikoma, how am i gonna get this on my attiny
02:52 PM Fuchikoma: You compile it?
02:53 PM Fuchikoma: It's also possible that by selecting the microcontroller before having a good grasp of what you needed to do software wise, you screwed yourself
02:54 PM Fuchikoma: You might need to upgrade the chip you're using, or abandon the SD card idea
02:54 PM mouseghost: Fuchikoma, how come
02:54 PM mouseghost: attiny too small?
02:54 PM Fuchikoma: I don't know what the memory requirements are for the SD card operations
02:54 PM mouseghost: i mean, if its the same as eeprom..
02:54 PM Fuchikoma: It's possible your ATtiny doesn't have enough.
02:55 PM Fuchikoma: It's the FAT management that will use the RAM
02:55 PM mouseghost: i wont use fat
02:56 PM Fuchikoma: Which ATtiny are you using?
02:57 PM mouseghost: Fuchikoma, well, i didnt really decide on mcu yet.. i was kinda joking, ive seen ATtiny3217
02:58 PM Fuchikoma: okay, looks like the ATtiny3217 has 2KB of SRAM
02:59 PM Fuchikoma: Which, based on what I'm reading on the Arduino forums, should be plenty
02:59 PM mouseghost: hhaha ^^!
03:00 PM Fuchikoma: https://forum.arduino.cc/index.php?topic=283555.0
03:00 PM mouseghost: but still, ill probably do serial - mcu (1)- sdcard (2)- temp sensor
03:01 PM mouseghost: so i can write bytes without filesystem to the sdcard
03:04 PM mouseghost: hm idk if mouser or tme is better here
03:07 PM mouseghost: Fuchikoma, and how can i use serial?
03:08 PM Fuchikoma: If you want to use the built-in UART hardware there are dedicated pins you need to use
03:09 PM Fuchikoma: But in that case, it's just a matter of setting up the hardware with some configuration data
03:09 PM Fuchikoma: And writing bytes to the buffere register
03:09 PM Fuchikoma: Write a byte to the buffer and the hardware sends it
03:10 PM Fuchikoma: You can either wait for a flag bit or an interrupt
03:10 PM Fuchikoma: And write the next byte
03:10 PM Fuchikoma: Loop until done
03:11 PM Fuchikoma: This is all pretty transparent if you're using a library though. If you're programming in C it'll be something like Serial.Print(data);
03:11 PM mouseghost: yeah im thinking C
03:12 PM Fuchikoma: https://appelsiini.net/2011/simple-usart-with-avr-libc/
03:13 PM mouseghost: uhh i need more learning i think
03:18 PM mouseghost: Fuchikoma, so i can set register ABC doing ABC = 0b100 to set it in C to a value 8?
03:18 PM mouseghost: and it just works?
03:19 PM Fuchikoma: Well if you're doing it in C then it's a lot easier
03:19 PM Fuchikoma: You just call a function to send a lump of data stored in RAM and it does it
03:19 PM Fuchikoma: So you'd probably read maybe 256 bytes of data out of the SD Card storage and send it
03:20 PM Fuchikoma: And repeat
03:20 PM Fuchikoma: (Or however much data you can read at once, depending on free RAM available)
03:20 PM mouseghost: im asking more like avr fundamentals :/
03:20 PM Fuchikoma: Oh
03:20 PM Fuchikoma: If programming in C I don't think you can access registers that directly?
03:21 PM Fuchikoma: You use variables instead, and the compiler decides how those variables are stored behind the scenes
03:21 PM mouseghost: ah, well, is there some kind of reference for that?
03:21 PM Fuchikoma: I don't know
03:24 PM mouseghost: well thanks, and now i broke something with my irc client
03:27 PM cehteh: Fuchikoma: with gcc you can assign variables to registers
03:27 PM cehteh: not a good idea, but its possible
04:19 PM rue_mohr: it only takes it as a suggestion and then it never takes the suggestion
04:19 PM rue_mohr: tried it and looked at the asm output
04:41 PM PoppaVic: you use the weirdo-syntax to specify the var as a reg, but pick regs that gcc doesn't usually use. Further ahead writing asm
11:57 PM day__ is now known as day