|
Today in babby I'm trying to have three(3) buttons work with my attiny. Due to the specific layout of the circuit I'm hooking too I can't simply have a button between ground and a pin on the mcu. I've associated each of the buttons to an arbitrary number to synchronize the port setup before polling a specific button. Circuit: This is my current code: code:
code:
However: code:
There's something really dumb I missing but I don't see what ? e: "fixed" by adding a bunch of nops before reading the pin status in the read_btn function unpacked robinhood fucked around with this message at 16:17 on Mar 10, 2017 |
# ? Mar 10, 2017 11:01 |
|
|
# ? May 30, 2024 09:01 |
|
UberVexer posted:Adafruit has a ton of projects in their learn system that are structured well, commented well, and are useful examples of how libraries work. Sagebrush posted:I'd start with the Adafruit stuff 100%. Thanks - turns out the Adafruit sous vide project is extremely close to what I'm trying to do, and it has good examples for using eeprom and state machine which is super relevant/helpful.
|
# ? Mar 13, 2017 18:58 |
|
I'm looking into making a time code generator with a Due for shits and giggles and need to bone up on how to do the programming side of the serial signal shaping (got lots of diagrams/info on the standard already thankfully). Does anyone know of a good reference? Searches with serial and arduino just get tons of really basic poo poo no matter what else I add into the search terms.
|
# ? Apr 5, 2017 02:22 |
|
Parts Kit posted:I'm looking into making a time code generator with a Due for shits and giggles and need to bone up on how to do the programming side of the serial signal shaping (got lots of diagrams/info on the standard already thankfully). Does anyone know of a good reference? Searches with serial and arduino just get tons of really basic poo poo no matter what else I add into the search terms. What is a time code generator? If I should know I probably can't answer your question then.
|
# ? Apr 5, 2017 04:04 |
|
It's pretty much exactly what it sounds like, you feed a circuit time from a source like GPS and it spits out a serial code that sensors or cameras can sync to so all your data has a consistent time stamp on it. Here's some more info, everything looks from their diagrams like it should be doable with a serial signal with I -think- 1 start bit, 8 data bits, and one stop bit. https://www.meinbergglobal.com/english/info/irig.htm
|
# ? Apr 5, 2017 23:41 |
|
Looking over some stuff maybe what I really need to do is find some good info on binary operations and let the arduino handle the rest. I'm going to do some searching after work but any recommendations for guides is appreciated.
|
# ? Apr 6, 2017 22:48 |
|
What do you mean by serial signal shaping? If it's what I'm thinking, then your microcontroller will have a serial UART that does that for you. The output of the UART is just pulses at 3.3 or 5V, so you then also need an RS232 transceiver to output at line level.
|
# ? Apr 7, 2017 16:34 |
|
I guess I mean setting everything up since it's clear this doesn't use 8N1 serial. Fortunately looking over the data sheets on the spec it looks like it is a 5v signal for the connection I intend to use and not the RS232 level. ed: maybe 9N1 since there are 9 bits of data, no apparent parity, and every 10th bit is a zero for position identification. Parts Kit fucked around with this message at 00:12 on Apr 8, 2017 |
# ? Apr 7, 2017 23:56 |
|
Sorry, I was skimming and didn't realize what you were doing. You might be able to get a UART to do what you need, but it might not be flexible enough to accommodate the different width pulses. At those speeds you could probably just bit bang it. There should be an SPI peripheral on the uC used by the arduino, which you might be able to use as an alternative to the UART. I think it would be limited to 8-bits output at a time with an AVR, you might be able to use it repeatedly to get a continuous stream.
|
# ? Apr 8, 2017 01:08 |
|
I recently got my first SMD Design back! It's a variant on a through-hole board I designed previously. It's an Arduino shield which can be used with the Arduino Mega to give RS232 and RS485 communications to the serial ports. It also has a header for connecting to Opto22 relays, and 3 extra LEDs for indication. Lessons learned on the prototype: 1) D+ and D- were switched, and some other silkscreen stuff I didn't catch. 2) LEDs were not of consistent brightness, but I'm not entirely surprised. I knew there would be mistakes so I ballparked what I thought might work. The LEDs are standard elecrow parts (R, G, and B smd leds), so I've got spec sheets form them now and will tinker and even out the LEDs to make them closer. 3) Using a stacking header upside down to connect the ICSP pins doesn't looks as nice as I'd like (left them out here). Maybe I'll just put a hole like I did for the reset, pin 13 LED, and RX/TX leds.
|
# ? Apr 8, 2017 01:40 |
|
taqueso posted:Sorry, I was skimming and didn't realize what you were doing. You might be able to get a UART to do what you need, but it might not be flexible enough to accommodate the different width pulses. At those speeds you could probably just bit bang it. There should be an SPI peripheral on the uC used by the arduino, which you might be able to use as an alternative to the UART. I think it would be limited to 8-bits output at a time with an AVR, you might be able to use it repeatedly to get a continuous stream.
|
# ? Apr 8, 2017 02:01 |
|
Captain Cool, thank you for your help (5 months later) with my ACH164 LED array that I pulled out of a dead switch. I missed your post the first time around. This point was key:Captain Cool posted:Use long instead of int. Unsigned Longs and Unions make everything better! This combined with bitWrite got my 32 bit binary counter test working. Time to start working on the CPU/MEM meter. Warning: 15 mb animated GIF: https://gifs.com/gif/MjnkV1 It starts with an unsigned long 4,294,967,295 (B11111111111111111111111111111111). 1=led off, 0=led on. There are 8 sections of code similar to this: top bits/bottom bits (evens/odds) * 4. Using bitWrite to manipulate the values based on two random()s. code:
code:
|
# ? Apr 8, 2017 07:44 |
|
I want to get more into Arduino and embedded development, what are the most recommended starter/project packs out there? Is Adafruit okay, or are there other sources I should get stuff from?
|
# ? Apr 26, 2017 19:00 |
|
Adafruit is great and anything they sell as a starter kit will do the job. Also check out Sparkfun or the official Arduino starter kit. I generally tell my students to stick to Adafruit and Sparkfun for their first couple of projects, because the documentation is really good (especially Adafruit) and there's tons of support for the specific products. With a $2 sensor board from eBay or AliExpress you'll be lucky to get a link to an out-of-date github page with a library. If you're on a budget, the ~$50 starter kits on Amazon are a good deal and most of the parts will work correctly, but they don't have any learning resources included. Adafruit, Sparkfun and Arduino itself are way better at that. Sagebrush fucked around with this message at 23:39 on Apr 26, 2017 |
# ? Apr 26, 2017 23:36 |
|
Sagebrush posted:Adafruit is great and anything they sell as a starter kit will do the job. Also check out Sparkfun or the official Arduino starter kit. I generally tell my students to stick to Adafruit and Sparkfun for their first couple of projects, because the documentation is really good (especially Adafruit) and there's tons of support for the specific products. With a $2 sensor board from eBay or AliExpress you'll be lucky to get a link to an out-of-date github page with a library. Hmm, I might grab one, then. I have an old MEGA 2560 and an Uno from way back when I first got one, but never got the chance to dive in. I'm gonna guess I should move to newer hardware? A starter pack wouldn't be a bad idea in that case. What do people do for development on an Arduino? I have an MBP and I remember using the Arduino IDE from the website. Is that okay, or are there better tools? Pollyanna fucked around with this message at 15:21 on May 1, 2017 |
# ? May 1, 2017 15:18 |
|
Pollyanna posted:Hmm, I might grab one, then. I have an old MEGA 2560 and an Uno from way back when I first got one, but never got the chance to dive in. I'm gonna guess I should move to newer hardware? A starter pack wouldn't be a bad idea in that case. The Uno R3 is still pretty much the "standard" Arduino and the Mega 2560 is basically a bigger version of the same, so you're fine hardware-wise. There are a lot of Arduino-compatible boards which are more popular in certain niches like Teensy or ESP8266 variants, but if something claims to be "for Arduino" odds are it's built for an Uno or Mega. The Arduino IDE is also pretty much the standard. It runs on every major platform and is what the "compatible" board vendors will be delivering their addons for. I'm sure you can use any C IDE but you'll have to figure out how to connect the toolchain yourself. wolrah fucked around with this message at 16:57 on May 1, 2017 |
# ? May 1, 2017 16:55 |
|
The Arduino IDE is just fine and works great. If you want something more advanced, you can use Visual Studio with the visual micro plug-in, or atmel studio, both of which are free, but they're pretty bloated for a beginner to figure out and don't offer anything that would be really useful to a learner anyway.
|
# ? May 1, 2017 17:36 |
Arduino IDE has come on by such leaps and bounds since I started using it, I'm sticking with it purely out of solidarity. Ever since they added auto library / board management all my gripes are gone.
|
|
# ? May 2, 2017 00:26 |
|
PlatformIO is nice of you start writing stuff for arduino longer than a few pages. I used it for a work project and highly recommend it. The Arduino IDE is usually good enough but it's missing a few quality of life features that you get with serious ides
|
# ? May 2, 2017 01:37 |
|
Ran across this whitepaper from Atmel the other day when I was trying to figure out how to make the readings from an analog sensor more accurate -- the paper describes an oversampling method to boost the effective resolution of the ADC at the cost of total processing time. Really helpful method, though obviously since you require exponentially more samples as you push further and further it can slow everything down. http://www.atmel.com/Images/doc8003.pdf Pushing the oversampling method to 4 more bits on an Uno takes a while, especially since I'm also doing some averaging of multiple measurements, using a float final output, and also running a GPS chip but it was a massive, massive difference in quality and stability. Sometime I've got to try it on my Due since the built in ADC is 12 bit instead of 10 like the Uno. On that general ADC/analog sensor stuff, has anyone tried messing with high/low range switches on AREF? I already tied it to 3.3v since that's what the sensor uses and won't put out any more voltage than at theoretical max, but at the same time the manufacturer's recommended range tops out about 3.12v so I'm thinking for a High I could stick a schottky diode to drop it to 3.15-ish instead of discarding the extra range and for Low I could throttle it even more with just plain rear end diodes so it won't try to measure with the higher voltage when the actual output won't hit say even half of that. Seems like something you could do easily with a single throw double pole switch and a few extra lines of code to kick on a warning LED if you've pegged it by accident.
|
# ? May 5, 2017 03:04 |
|
I saw that method before and like isn't it literally just time-domain oversampling? Old old old trick. Like it's neat and all but when I was reading that I was like "okay, but get to the clever bit" and it didn't happen. Like if you do one reading and you get a 668, that's your reading. But if you do 5 readings and get 668,668,664,667,669 and you can assume (1) the signal is constant and (2) the noise is normally distributed around the mean, then you can fairly reliably say that your input reading is 667.2. They even say that it doesn't work unless the source has some noise, which is exactly what you'd expect with that method.
|
# ? May 5, 2017 03:14 |
|
I wouldn't be surprised that it's an old trick, but I'm still relatively new to all of this stuff so it was a huge help.
|
# ? May 5, 2017 03:25 |
|
fake edit: ha, whoops, I thought I was posting in the general electronics thread and not the Arduino thread. It's a good technique for sure and certainly qualifies as a clever trick if you're new to programming and electronics. Filtering signals can be extraordinarily complicated. re. your question about adjusting the AREF pin voltage to scale the ADC range -- I'd probably just ignore the difference between 3.3 and 3.15v and make up the difference with code calibration. It's useful to shift the range in broad strokes but any sensor is going to have at least a few millivolts of noise, and no analog device is ever going to behave exactly like another one, and so on. If the extra 50 steps at the top end that you get by using a diode are critical to proper operation of whatever you're building, you're likely to run into problems caused by normal analog behavior regardless of where you set the peak. In that case I'd probably just get a 16-bit SPI ADC (like a dollar on Digi-Key) and have 65 times more resolution than I needed and forget about it.
|
# ? May 5, 2017 03:57 |
|
Rad. Definitely was thinking about getting some individual ADCs anyways.
|
# ? May 5, 2017 04:33 |
|
Just a quick question. The wife wanted our new baby stroller to be distinctive, so I'm looking to add EL wire for the frame and a rotating LED POV display for the wheels. Adafruit seems to have a kit that'll work for the latter, but I've never soldered anything or built a board like this before. Is this reasonable for a first time project or am I going to be in over my head pretty quickly?
|
# ? Jun 14, 2017 16:49 |
|
Doesn't POV require some pretty decent wheel RPM to actually work? How often is a stroller going to achieve that sort of speed? That said EL wire is dead simple so assuming you're using a kit for the POV stuff this is entirely reasonable as a first project.
|
# ? Jun 14, 2017 17:27 |
|
wolrah posted:Doesn't POV require some pretty decent wheel RPM to actually work? How often is a stroller going to achieve that sort of speed? I figured if the RPM is insufficient to get a consistent image I can still program in some designs to utilize the motion.
|
# ? Jun 14, 2017 17:43 |
|
dirksteadfast posted:Just a quick question. The wife wanted our new baby stroller to be distinctive, so I'm looking to add EL wire for the frame and a rotating LED POV display for the wheels. Adafruit seems to have a kit that'll work for the latter, but I've never soldered anything or built a board like this before. Is this reasonable for a first time project or am I going to be in over my head pretty quickly? EL wire uses a high-frequency inverter that makes an audible whistling noise that I am sure a young child would be able to hear, so maybe don't go that way. Get NeoPixel LED strips instead. e: and yeah with a single POV strip on a 700c bicycle wheel (622mm diameter) you need to be going like 20mph for total persistence. Smaller wheels will mean you can go slower but you're still gonna be running Sagebrush fucked around with this message at 18:51 on Jun 14, 2017 |
# ? Jun 14, 2017 18:00 |
|
Also, have you seen EL wire in daylight?
|
# ? Jun 14, 2017 18:40 |
|
Thanks for the input from all. I hadn't ordered anything yet and will consider the new recommendations.
|
# ? Jun 14, 2017 19:39 |
|
Mosdef get weatherproof neopixel tape. The adafruit learning thingimajig has good sample code to make it do cool/psychedelic stuff.
|
# ? Jun 15, 2017 18:29 |
|
JawnV6 posted:Also, have you seen EL wire in daylight? Yeah definitely use those LED strips, EL wire looks wicked cool from dusk to dawn, but is invisible during daylight. Also, that whine is pretty audible as long as you're within 15' of a wall, and irritating indoors.
|
# ? Jun 19, 2017 01:19 |
|
Anyone have experience with ESP8266 reliability in a long-term application? I want to DIY some home automation sensors and device controllers as a learning experience, but I don't want to have to fiddle with the things regularly once I get them working how I want. There seems to have been a lot of talk questioning their reliability a year or so ago and then it seems to have tapered off, so I'm not sure what to think. None of it will be for any critical roles, just things like additional temperature sensors and control of the garage door opener, but want to be able to be confident that any failures I experience are my own fault and not the hardware.
|
# ? Jul 1, 2017 14:38 |
|
wolrah posted:Anyone have experience with ESP8266 reliability in a long-term application? I want to DIY some home automation sensors and device controllers as a learning experience, but I don't want to have to fiddle with the things regularly once I get them working how I want. There seems to have been a lot of talk questioning their reliability a year or so ago and then it seems to have tapered off, so I'm not sure what to think. It depends what you mean by reliability. Is a shutdown and recovery lasting 15 minutes every 10 hours still reliable because it has 0 consequences? Anyway here's a thing that shows there's a fair amount of fiddling for your application and the longest ever period without a reset was less than 2 months.There's a link at the bottom of the article to the ThingSpeak page that has the data: https://internetofhomethings.com/homethings/?tag=esp8266-stability
|
# ? Jul 1, 2017 15:14 |
|
Assuming the hardware itself doesn't crap out, and you haven't inadvertently done something dumb like code in an unhandled overflow, microcontrollers are usually extremely reliable. I wouldn't put a homemade ESP8266 IoT device on my thermostat or oven or whatever just on principle, but I'd be perfectly confident attaching one to a lamp. The previous poster's point is also good. Even if the system does get crapped up somehow, is it acceptable to have it automatically reset every day for a few seconds at 3am? e: I read the link posted above and the guy says that his ESP8266 was crashing all the time -- but also that he was polling for HTTP requests on every loop (not a good idea) and that his USB to serial converter was browning out. So poor code practice and a broken external component. He fixed those two things and the chip runs perfectly. Ergo: yes, it's totally possible if you do it right. Sagebrush fucked around with this message at 17:50 on Jul 1, 2017 |
# ? Jul 1, 2017 17:44 |
|
wolrah posted:Anyone have experience with ESP8266 reliability in a long-term application? I want to DIY some home automation sensors and device controllers as a learning experience, but I don't want to have to fiddle with the things regularly once I get them working how I want. There seems to have been a lot of talk questioning their reliability a year or so ago and then it seems to have tapered off, so I'm not sure what to think. I've had a ESP8266 running with a temperature sensor for at least a year, and I haven't had to tend to it even once. I've configured it to just start over whenever anything fails - so if there's wifi outage, power outage, whatever, it just starts working whenever it resolves itself. (This reminded me that I actually need to update it with my new wifi credentials; changed them a few days ago.)
|
# ? Jul 3, 2017 12:37 |
|
CarForumPoster posted:It depends what you mean by reliability. Is a shutdown and recovery lasting 15 minutes every 10 hours still reliable because it has 0 consequences? If it takes 15 minutes to recover that might be annoying for certain things like the garage door opener, but yeah reboots are no big deal for the kinds of things I'm picturing.
|
# ? Jul 4, 2017 03:20 |
|
Something like an ESP8266 takes like 15 seconds to recover, if that, and most of that time is reconnecting to the wireless. "Boot" time is effectively zero.
|
# ? Jul 4, 2017 04:31 |
|
Sagebrush posted:Something like an ESP8266 takes like 15 seconds to recover, if that, and most of that time is reconnecting to the wireless. "Boot" time is effectively zero. This. I was making a point about reliability being baked in to your error handling/software/use case rather than being worried about "reliable" hardware. I haven't used an ESP8266 but my Arduinos resume on crash/power failure in something like 30 seconds or less. EDIT: When you can properly recover from failures in the micro controller world you're now only worried about "hard"/permanent failures which are much less frequent. You still have to prepare for them and make sure whatever is receiving this data handles soft and hard failures without causing major issues. You wouldnt want your A/C to stay permanently on because your ESP8266 outputs a stream of 82°F even though the temp is really 70°F. CarForumPoster fucked around with this message at 05:03 on Jul 4, 2017 |
# ? Jul 4, 2017 04:59 |
|
|
# ? May 30, 2024 09:01 |
|
I am crossposting this to the electronics megathread because it's an overlapping subject. I've never worked with motors. My arduino knowledge has mostly been lights/sound. I'm working on the ZF-1 gun from the Fifth Element. https://www.youtube.com/watch?v=7jVsQToSfag There are a few hatches and things that I'd like to engineer into actually opening or extending, controllable via arduino. First impulse was to look up "linear actuator", only to discover that that poo poo is expensive, probably because most of them are load bearing. What's the cheapest way to do something like extend a barrel here? Something with a regular motor and a rail with teeth? Is there an easier answer I'm missing?
|
# ? Jul 7, 2017 02:30 |