|
What's a good refresher on the electronics side of things for arduino projects (and beyond I suppose, but arduino at minimum)? The kit I bought focuses almost entirely on the coding side of things and even though I was pretty comfortable with circuits and such in college, it's been about 10 years and I'm rusty.
|
# ? Aug 27, 2016 03:14 |
|
|
# ? May 30, 2024 07:36 |
|
A lot of Arduino projects don't need a tremendous amount of electronics knowledge. You just kind of plug data into data, power into power, ground to ground, and maybe stick in some resistors or decoupling caps here and there. Everything else is done in software. If you can build a voltage divider you're good. If you want the classic electronics introduction, starting with analog circuits and how to build them, get the Forrest Mims III books. Just don't read anything of his that's not about electronics.
|
# ? Aug 27, 2016 06:13 |
|
Idk what people think about it here but Make: Electronics is a phenomenal book IMO. I learned how to program an arduino and make poo poo blink years ago and forgot it all. While Make: Electronics doesnt talk too much about microcontrollers specifically, it does guide you through a ton of electronic theory and fundamentals while being super entertaining and project focused. I highly recommend it. My latest arduino project: https://github.com/chrisgillis/nextbusclock
|
# ? Aug 28, 2016 05:53 |
|
First Time Caller posted:Idk what people think about it here but Make: Electronics is a phenomenal book IMO. I learned how to program an arduino and make poo poo blink years ago and forgot it all. While Make: Electronics doesnt talk too much about microcontrollers specifically, it does guide you through a ton of electronic theory and fundamentals while being super entertaining and project focused. I highly recommend it. All books from Make are 50% off. Just snagged both electronics books. quote:Use code "BACKTOSCHOOL16" to get 50% off books through August 31st!!
|
# ? Aug 28, 2016 06:12 |
|
I'm trying to use multiple OR conditions. Is this correct? Something isn't working and I'm trying to narrow down the culprit.code:
|
# ? Aug 31, 2016 03:56 |
|
2, 3 and 4 will all evaluate to true (since they are not 0), which means that if statement will always be true. To have it check if MODE is 1, 2, 3 or 4 you should write out the whole statement in each case: code:
code:
Seat Safety Switch fucked around with this message at 04:18 on Aug 31, 2016 |
# ? Aug 31, 2016 04:14 |
|
Seat Safety Switch posted:
Thanks much. That clears it up. Seat Safety Switch posted:2, 3 and 4 will all evaluate to true (since they are not 0), which means that if statement will always be true. Why would they all evaluate to be true? I assume in a simpler form, do you mean that code:
|
# ? Aug 31, 2016 04:24 |
|
0 is the only False. Everything else is True.
|
# ? Aug 31, 2016 04:30 |
|
SkunkDuster posted:Thanks much. That clears it up. Yes that's true. It's common (and often convenient) in programming languages for zero to be false and anything else is true. In the background boolean statements like (a==b) evaluate to a 1 or zero. So the If statement is always just checking for a zero or not. Statement like (a==b)*c (which either returns c or zero) are also possible and often useful.
|
# ? Aug 31, 2016 04:33 |
|
speaking of enums, that's something I've been trying to sort our about how I want to use. I'm trying to develop my own "standard" of how I declare particular constants. Granted, I know there are pluses and minuses for any of these, but these are what I'm thinking after trying out varying options on a few different programs: -Don't use #define unless I am using a #ifdef or something like that later in the program for particular debug information or something like that (increasingly uncommon) -use const for variables that may be tweaked during the development process (IE, calibration variables like the minimum reading and maximum reading I want a sensor to use). I think I like consts there because then it makes me more aware of when I might accidentally create a rollover situation by changing (I'm less likely to throw a value of 300 if it is a const uint8_t/byte) -use enum only for human-readable states. Sometimes I've used them for things like Pins and whatnot (i.e., LED, SENSOR) but I'm not entirely confident in it because I'm not entirely sure I fully understand enums as is. I always name all my constants of any of these in All Caps to make them easier to spot. I also use Visual Micro, so I have some nice syntax highlighting on #defines and enums, but I wish I could find some way to highlight const types because I prefer to use them but I wish they would highlight. any thoughts re: this being good or bad practice?
|
# ? Aug 31, 2016 04:43 |
|
asdf32 posted:Yes that's true. It's common (and often convenient) in programming languages for zero to be false and anything else is true. Leads to weirdness like this, too: code:
|
# ? Aug 31, 2016 05:50 |
|
I always seem to be too late to be relevant to the conversation, but I made an ISP on a breadboard with a ZIF socket to program blank 328P chips: Hooks up to an Uno running the ArduinoISP sketch with just a few wires (there are schematics all over the place for the whole rig) and works like a champ.
|
# ? Aug 31, 2016 11:10 |
|
Sagebrush posted:Leads to weirdness like this, too: Weird sometimes but good to know in general. Most math applications support it. In LTSpice for example arbitrary voltage sources let you insert booleans where you couldn't insert an IF statement.
|
# ? Sep 2, 2016 04:20 |
|
I started writing a little screen editor in Processing as a personal project to create graphics for a 5$ 128x64 screen I have. I figure it might interest some people in this thread. It outputs C instructions for the u8glib library, the tools correspond to some of the primitives found in the library. The window looks like this and outputs code like this in the console (when pressing P) code:
for example selecting this zone outputs code:
- the Z key removes the last action - disc tool does nothing yet - the toolbar at the bottom isn't clickable I haven't tested the generated code yet because I need to install things on my computer to upload to a uC again and it's sorely missing some basic functions (a dialog for file saving, freehand drawing), the code is also pretty horrific but it seems to be doing the job. I'm aware there are probably a thousand better tools out there but hey, this one's mine. I'll probably put in some more work to make it compatible with other screen sizes, sometime in the future. Github here
|
# ? Sep 2, 2016 16:45 |
|
SkunkDuster posted:I'm trying to use multiple OR conditions. Is this correct? Something isn't working and I'm trying to narrow down the culprit. For multiple conditions I would have thought CASE would be the way to do it, is that not right?
|
# ? Sep 2, 2016 19:57 |
|
Using switch/case instead of chained conditionals is equally valid, yeah. I don't know which one is more cycle-efficient -- I haven't really run into a situation where it mattered. I bet they compile into pretty much the same thing.
|
# ? Sep 2, 2016 20:03 |
|
If you use powers of two for values (this means each value maps to a single, unique bit in the word), then bitwise operators can sort of perform the comparison in the way you originally wrote.code:
This technique is more useful if you have certain non-mutually-exclusive flags or properties that describe your "mode". peepsalot fucked around with this message at 20:27 on Sep 2, 2016 |
# ? Sep 2, 2016 20:22 |
|
First Time Caller posted:Idk what people think about it here but Make: Electronics is a phenomenal book IMO. I learned how to program an arduino and make poo poo blink years ago and forgot it all. While Make: Electronics doesnt talk too much about microcontrollers specifically, it does guide you through a ton of electronic theory and fundamentals while being super entertaining and project focused. I highly recommend it. Just wanted to say thanks for this! I know the Arduino doesn't require a degree in electronics but I like knowing what's going on when I'm playing with the breadboard.
|
# ? Sep 4, 2016 22:46 |
|
Sagebrush posted:Using switch/case instead of chained conditionals is equally valid, yeah. I don't know which one is more cycle-efficient -- I haven't really run into a situation where it mattered. I bet they compile into pretty much the same thing. Looking at the generated code, a case is slightly more efficient. The case evaluates into a jump table, and the chained conditionals are all evaluated. You'd have to do some serious testing and actually NEED to find optimization for that to be worthwhile. I like doing things like this: C code:
|
# ? Sep 5, 2016 16:35 |
|
How would the arduino parse this: (A > B && C < D) Would it be like ((A > B) && (C < D)) or (A > (B && C) < D) or something else?
|
# ? Sep 13, 2016 02:42 |
|
http://en.cppreference.com/w/cpp/language/operator_precedence It would be ((A > B) && (C < D)), since the relational operators has higher precedence than the logical AND.
|
# ? Sep 13, 2016 02:59 |
|
In general as a best practice always add parenthesis even when you know the compiler / language order of operations. It will save the next person looking at your code an incredible amount of pain and very likely prevent major bugs. And remember that next person might be you years from now trying to remember what the heck you were doing.
|
# ? Sep 14, 2016 02:36 |
|
mod sassinator posted:And remember that next person might be you years from now trying to remember what the heck you were doing.
|
# ? Sep 14, 2016 10:33 |
|
i was gifted an arduino uno and i have minimal prior experience with any of this stuff. in high school i built breadboards and programmed 8051s but that was mostly the teacher showing us the motions rather than me actually learning anything and my magnum opus was making it beep 'in a gadda da vida' so thats the level of programming genius we're talkin about here with an atmega u16 im not really sure what the capabilities of this thing are. i was maybe thinking about building an auxiliary audio recording box but i think that might not be an arduino project and i should just buy one what do i need to like.. do poo poo? can i just plug a power source and a usb port in, send a program and it will work? hell i don't even know what language or programming suite. please tell me its c and just command line utilities because i dont want to learn an entire sdk
|
# ? Sep 24, 2016 14:59 |
|
Arduino is neither commandline utilities nor an entire SDK. It's a single text editing window with a button at the top that you click to compile and burn your code in one shot. It's super easy. The Arduino "language" isn't a programming language of its own. It's plain old C/C++, with a big header file that predefines a number of macros and functions to make the process easy for beginners.E.g. instead of flipping port register bits, you can type"digitalWrite(13, HIGH) to set pin 13 high. Because the language is C, though, you can also flip register bits if you like, and mix-and-match code as you see fit. The boards plug in through USB and usually don't even need a driver. They are powered by the same USB connection, at least until you start doing really high-power stuff like driving big motors or chains of LEDs. If you like using command-line utilities or a different IDE, you can. Arduino just makes a bunch of calls to avrg++ and avrdude behind the scenes , and Atmel has their own IDE that is quite nice. Download the software from the Arduino website, plug in your board, and follow the tutorial to upload the first blink sketch. It's pretty simple. Sagebrush fucked around with this message at 15:58 on Sep 24, 2016 |
# ? Sep 24, 2016 15:53 |
|
Just in case none of you believed me.
|
# ? Sep 24, 2016 20:08 |
|
That's cool. Out of curiosity, can you keep track of how many of them, if any, are dead or damaged? My students often ask me if the SainSmart Arduinos are reliable enough to buy for the class I teach, and so far all I can tell them is the three or four that I've bought have been fine but that the real Arduino is all I can truly recommend. 670 is enough to get some real statistics, though.
|
# ? Sep 26, 2016 04:11 |
|
nigga crab pollock posted:i was gifted an arduino uno and i have minimal prior experience with any of this stuff. in high school i built breadboards and programmed 8051s but that was mostly the teacher showing us the motions rather than me actually learning anything and my magnum opus was making it beep 'in a gadda da vida' so thats the level of programming genius we're talkin about here With the uno, the chip you're usually programming is a atmega 328p, not the 16u. The 16u is there to do usb to serial translation, as it has native usb hardware. You can program it which is nice if you want to make it a like a hid(keyboard, mouse, joystick etc) or midi device, or other more esoteric usb things. People have done sound recording before. The biggest limit is that the onboard memory is very small (2k of eeprom) external flash is kind of low bandwidth, though there are encoders out there that are fast enough to compute, and compress well enough to fit in the bandwidth constraints. Quality isn't so hot. Basically, suitable for easily discernable speech but definitely not musical.
|
# ? Sep 26, 2016 04:48 |
|
Sagebrush posted:That's cool. Out of curiosity, can you keep track of how many of them, if any, are dead or damaged? My students often ask me if the SainSmart Arduinos are reliable enough to buy for the class I teach, and so far all I can tell them is the three or four that I've bought have been fine but that the real Arduino is all I can truly recommend. 670 is enough to get some real statistics, though. I found two that I didn't trust during the flashing process. They seemed to be drawing a ridiculous amount of power, 8+ times what they were supposed to be, so I threw those out. Rest all seemed to be fine out of the box. In terms of tracking them: I've got an application written that queries all USB devices connected and reads the serial output. Each of the 48 connected to a server returns a different message: Hello-01, Hello-48, etc. Each device's logical device /dev/usbACM# is then related to the Hello returned to provide abstraction for what actually pushes commands down to the arduinos. If a number between 1-48 doesn't appear then something Really Bad has happened.
|
# ? Sep 26, 2016 05:12 |
|
I've made an u8glib editor utility in Processing to draw screen items faster. You draw on screen using tools that replicate the library's primitives, it spits C code in the console. Main features:
Screens: Basic toolbar Preview Sample actual output screens There doesn't seem to be much interest for this but I'm mostly done and I figure some people would use it. It's pretty rudimentary and missing basic features but works like I want.
|
# ? Oct 12, 2016 14:57 |
|
Super excited for the ESP32, I've been doing projects in the Arduino IDE and compiling on the ESP8266.
|
# ? Oct 12, 2016 19:29 |
|
Threw something together for my front porch on Halloween. Going to get either a black light or other colored bulb for the scream light, and I think I've got a paper lantern for the "normal" light to make it look more like my normal porch light. Using a PIR sensor for motion, and the audio is playing directly off a PWM pin on the Arduino. https://www.youtube.com/watch?v=ccAL11wI_5s
|
# ? Oct 14, 2016 14:45 |
|
unpacked robinhood posted:I've made an u8glib editor utility in Processing to draw screen items faster. This is really cool. I only have used screens a few times, and used the adafruit libraries. This might give me a push to try out u8glib stuff
|
# ? Oct 14, 2016 22:55 |
|
I'm updating my portfolio and I've got some videos saved that I thought you guys might enjoy. https://www.youtube.com/watch?v=vDLHhMvcVL0 https://www.youtube.com/watch?v=E8Qu_i_7nHc
|
# ? Oct 15, 2016 03:36 |
|
unpacked robinhood posted:I've made an u8glib editor utility in Processing to draw screen items faster. This is great, Ive used u8glib in several projects in the past, I will be looking at this closely in the future! Thanks sir!
|
# ? Oct 15, 2016 03:42 |
|
I haven't done anything interesting with embedded stuff for a while and I'm getting the itch to start messing around again. What are some good project packs/kits to pick up? Adafruit's project packs page doesn't have a whole bunch of interesting things (aside from a motherfucking Moog synthesizer holy poo poo). I've never gotten much further in than trying to get a Raspberry Pi to play nice with my Macbook, and I kinda want to branch out of plain ol' web development programming-wise.
|
# ? Oct 17, 2016 23:37 |
|
I dunno, what kind of stuff do you want to build? Audio/video/media -> stick with the Raspberry Pi Bleeping and booping audio synthesis, basic bitmapped graphics -> Arduino OK Sensors, motors, low-level electronics -> Arduino Lots of networking, hosting a complex web server, multiple clients -> RPi Basic networking, building sensor nodes, uploading little bits of data to a server -> Arduino. What do you already own?
|
# ? Oct 18, 2016 04:10 |
|
If you want something Arduino like that can connect to the internet, check out the ESP8266 based NodeMcu. It's compatible with the Arduino IDE/libraries and is around $5ish bucks iirc.
|
# ? Oct 18, 2016 04:32 |
|
Sagebrush posted:I dunno, what kind of stuff do you want to build? I've already got a Raspberry Pi B+ from 2 years ago, and an Arduino...Uno?...that I picked up around the same time. I'm more into software than hardware by trade, and I was initially drawn to the idea of writing a VM for CHIP-8 using a Raspberry Pi and a couple digital output thingies, but I never got around to it cause I found programming on a Raspberry Pi to be too difficult (didn't know how to install stuff on it, couldn't figure out how to set up a dev environment for Python or Ruby or Go or Rust or C or something, etc.). I kinda want to actually tackle that project again, but I wouldn't know where to start. Mechanical stuff like servos and sensors sound cool, but I have no idea what I'd use them for. I don't have many problems that can be solved with those things, and what I can think of doing is kinda piddly and dumb:
I have very little experience in networking, concurrency, nodes, etc. and I don't really know of anything I would need to apply that to or why I would do a bunch of networking...work. So that stuff doesn't excite me as much Audio synth is certainly interesting, and that one Moog synth sounds fun as poo poo, but it's not quite as much of a "follow-along" DIY project as I'd hoped. I don't really have need of streaming media around my apartment. Basically, it looks like low-level electronics and trinket-y graphics are where I'm headed? And apparently that's Arduino. Arduino is primarily C though and I have jack-all C experience, much less making a big project in it rawrr posted:If you want something Arduino like that can connect to the internet, check out the ESP8266 based NodeMcu. It's compatible with the Arduino IDE/libraries and is around $5ish bucks iirc. I might need to do internet stuff, actually! I'll take a look at that and see if I can figure out what to do with it
|
# ? Oct 18, 2016 15:53 |
|
|
# ? May 30, 2024 07:36 |
|
I pulled a 32 LED display off of a dead 16 port switch. I'd like to turn it into something useful, like a VU meter or CPU/memory meter. The circuit is just 4 AHC164 shift registers (no latch) and the LEDs. I have a general idea of how to make this work, but my solution seems really inelegant. pre:Link 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 Power X Activity 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 Therefore, if I want to have 2 different types of data, I need to have my values pre-computed and combined before I execute my shift register control code. pre:128 32 8 2 64 16 4 1 As I understand it, the DSA & DSB inputs are ANDED together. I'm only using 1 input, so is this why I am having to invert my 0's and 1's in my code to get the LED to light? Let's say my CPU usage is at 70% and memory usage is at 30%. I want the display to look like this (0's on, X's off): pre:Link XXXXX00000000000 Power 0 Activity XXXXXXXXXXX00000 code:
There's got to be a better way. Related question: How do I make binary counter using an Arduino nano which will count higher than 65,535? Another For loop which increments if j=0? code:
The 16's place should be pin 4, not pin 3 The 128's place should be pin 7, not pin 6 code:
|
# ? Oct 22, 2016 10:21 |