|
I've got a digispark pro (ATtiny167 based device) and I'm trying to read temp/humidity data from an AM2320. I can't get a proper read from it. The datasheet says the response should be a sequence of bytes confirming the instruction, the datagram length, the requested data, then a two byte CRC. What I'm actually getting back is the instruction confirmation, a zero byte, the expected length, then 0 bytes for the rest of the data. I've got it hooked up to 5v and to the SDA/SCL pins on the pro (with 4.7k pullups) and the basic code I'm using is as follows: code:
As far as I can tell the timings in the USI_TWI_Master files are exactly what the sensor expects but I'm not confident enough to try change any of those values. I've also seen other code samples for this sensor put a delay between reads but with the tinywire library the requested data is prefetched when requestFrom is called so there's no point. Any ideas what's loving up and how I can fix it?
|
# ? Mar 14, 2016 13:22 |
|
|
# ? May 29, 2024 11:24 |
|
Ephphatha posted:I hadn't been checking the return codes of most of the wire calls when first testing since it seems to recognise the command and at least start to build a proper response, so I'm not sure if the no-acks are something I should be concerned about. I'm also getting a consistent response, the exact same sequence of bytes and (99.9% of the time) the same error codes for the endTransmission/requestFrom calls every time it executes.
|
# ? Mar 14, 2016 14:19 |
|
Does anyone sell kits for all the parts needed to make more permanent Arduino projects? I believe this is the list of required parts: Atmega8/16 16MHz crystal 22pf capacitor 10uf capacitor Resistor 10K , 100K Jumber wire
|
# ? Mar 15, 2016 00:12 |
|
Captain Cool posted:You're not actually talking to the device. The device should ack its address. The response you're getting -- 03 00 04 00 ... -- is the same as the command you sent. I'm guessing the Wire library uses the same buffer for sending and receiving. Welp, that seems so obvious in retrospect. Thanks, I'll see if I can get this thing to respond.
|
# ? Mar 15, 2016 01:11 |
|
huhu posted:Does anyone sell kits for all the parts needed to make more permanent Arduino projects? I'd just make a mass order on Digikey for however many you plan to make and then re-up the cart as you run out. Their shipping is pretty fast. You'll probably also want something to handle the 5V power supply and some kind of programmer for the AVRs (I guess you could use Arduino ISP).
|
# ? Mar 15, 2016 01:21 |
|
huhu posted:Does anyone sell kits for all the parts needed to make more permanent Arduino projects? Seat Safety Switch posted:I'd just make a mass order on Digikey for however many you plan to make and then re-up the cart as you run out. Their shipping is pretty fast. https://www.sparkfun.com/products/114
|
# ? Mar 15, 2016 01:34 |
|
Dad asked me to pass on his thanks. He was able to get his assembly file loaded using objcopy so that is a big roadblock out of the way.
|
# ? Mar 15, 2016 02:37 |
|
Star War Sex Parrot posted:Neat. Reminds me of the intervalometer I made a year or so ago: How long does this generally last? Is the camera good at going into some sort of a standby mode? Edit: Found this for the barebones Arduino: http://www.ebay.com/itm/Bareduino-Bare-minimum-16-MHz-Arduino-Kit-/321280659150?hash=item4acdd1cece:g:XfkAAOxy63FSthRf huhu fucked around with this message at 18:34 on Mar 15, 2016 |
# ? Mar 15, 2016 18:26 |
|
huhu posted:Does anyone sell kits for all the parts needed to make more permanent Arduino projects? If you can live with running the MCU and 8MHz instead of 16, and you don't care about timing being super-precise, you don't need the crystal.
|
# ? Mar 15, 2016 23:27 |
|
edit: I think I've seen the problem (of course, just after I post asking for help!). I will never get more than a couple of ms difference between the currentMillis and previousMillis, due to where it updates those values, right? I mentioned before that I am totally new to all this, so sorry in advance for the stupid newbie question. I don't really understand why it isn't working, so I thought I'd ask here. I have spent over an hour since I thought the code was passing Verify checks trying to get the LED to flash, in a couple of different ways, so it's not like I gave up at the first hurdle. After a couple of weeks of reading around on-and-off, I finally got around to installing the IDE and plugging in the arduino! I thought the best idea would be to start by modifying an example program. I chose to try to make an asymmetric "BlinkWithoutDelay" (since I don't want to get into the habit of relying on delay - I'm going to need to be scanning a lot of inputs for my final "Ultimate Goal" project). However, I've hit a bit of a wall. Blink and BlinkWithoutDelay work, so I know it must be me getting something wrong - problem is, I can't see what. code:
Of course, the first bit of troubleshooting I did was to mess around with things and see what changed. If I set previousMillis at the beginning to 990, on upload the LED starts on and stays on I also tied rephrasing what I want as something a little closer to the initial example: code:
simplefish fucked around with this message at 20:51 on Mar 16, 2016 |
# ? Mar 16, 2016 20:46 |
|
You'd probably want to put your previousMillis = currentMillis; // shift the timer along inside the if/then, right?
|
# ? Mar 16, 2016 20:50 |
|
Yeah, I saw it right as I posted it (sod's law), and got it to work:code:
Really impressed how fast you replied, and straight to the point, though - thank you!
|
# ? Mar 16, 2016 20:53 |
|
simplefish posted:Yeah, I saw it right as I posted it (sod's law), and got it to work: I've been in your shoes!
|
# ? Mar 16, 2016 20:54 |
|
It works with the alternative phrasing too. Is one better than the other (boolean vs nesting ifs)? If one's a bad habit, I'd rather not form it at this stage,
|
# ? Mar 16, 2016 20:56 |
|
I'm trying to move my arduino circuit to an Atmega328 powered circuit. I've got an SD card reader that requires 3.3V but everything else needs 5V. How would I wire up the SD card reader?
|
# ? Mar 16, 2016 23:19 |
|
Edit: So after a ton of reading, it looks like I have to connect pin 1 on the Atmega to Reset on the Arduino to upload a sketch. Not sure why this wasn't mentioned in the guide I was reading. Can't attach image to edits so uploading here with new post... I purchased an Atmega328P-PU from my makerspace and they burned the atmega328 bootloader to it. I wired everything up and I have a blinking light so I know it works. I select the Arduino/Geunino Uno from the dropdown menu as the board and try to upload any sketch and get: code:
huhu fucked around with this message at 00:36 on Mar 17, 2016 |
# ? Mar 17, 2016 00:11 |
|
simplefish posted:Is one better than the other (boolean vs nesting ifs)? If one's a bad habit, I'd rather not form it at this stage, When you say boolean, do you mean &&, the logical AND? I don't think there's a functional difference between that and the conditional if/else statement, in terms of execution time or whatever. Using the conditional gives you the option of multiple paths of execution though: code:
code:
huhu posted:I'm trying to move my arduino circuit to an Atmega328 powered circuit. I've got an SD card reader that requires 3.3V but everything else needs 5V. How would I wire up the SD card reader? Get thee to a level shifter. SD cards are low enough current that you could probably get away with a pair of resistors in a voltage divider.
|
# ? Mar 17, 2016 07:10 |
|
I'm building a kind of self-calibrating stepper-motor controller thingie, and I can already feel I'm going to need an event and timer system, which goes beyond the basic low-level timer libraries. Is there any one good "framework" which provides good implementations of these kinds of things? I've found 3 or 4 different libs that have varying levels of quality. This just feels like basic stuff that a smart group of people might have done before. Any ideas?
|
# ? Mar 21, 2016 13:26 |
|
v1nce posted:I'm building a kind of self-calibrating stepper-motor controller thingie, and I can already feel I'm going to need an event and timer system, which goes beyond the basic low-level timer libraries. Is there any one good "framework" which provides good implementations of these kinds of things? I've maybe been doing something similar using accelstepper. Does this help? code:
|
# ? Mar 22, 2016 05:23 |
|
That's a bit more specific than what I was going for. I was more interested to see if there's any group of libraries out there with general implementations of event and timer stacks. To be more specific about what I'm doing: I'll have several pieces of hardware attached to a single Teensy. Each item needs to perform calibration operations, which written at their most basic, use delay() and block the main thread. The calibration really doesn't need to happen one-by-one. I can rewrite these methods to be event/timer based and non-blocking, but I was paralysed by the choice of so many disparate libraries. Is there any one main-effort general-purpose community library for these general purpose things, or am I just best off going for "whatever works"? Edit: the hardware is only analogous to a stepper motor; it isn't actually one. I've already got that part sorted, but I want to un-block the main thread during calibration. v1nce fucked around with this message at 06:02 on Mar 22, 2016 |
# ? Mar 22, 2016 05:48 |
|
Are there any good video series that go through various important components in Arduino projects? Right now I'm looking at videos for 555 timers and stepper motors and am wondering if there are a series that introduces various components?
|
# ? Mar 28, 2016 18:25 |
|
I'm not sure about videos, but https://learn.adafruit.com/ has a huge amount of guides and tutorials from components to projects.
|
# ? Mar 28, 2016 18:43 |
|
Is there anyway to multiplex a 4x4 keypad using a 165 or 4021? Or any other IC or protocol? Throw in a 1602 LCD and I'm practically out of pins on my nanos. I have read I can use resistors in conjunction with an analog switch or gently caress around with a 595+165 but I'd prefer simple over complex. SPI? ic2?
|
# ? Mar 29, 2016 18:08 |
|
Any suggestions for a robotics kit that isn't just a "buy this preassembled thing, load the code and run it"? I'm looking for a package that might have parts to make basic linear/rotational movement, wheels, motors, etc.
|
# ? Mar 29, 2016 18:35 |
|
politicorific posted:Is there anyway to multiplex a 4x4 keypad using a 165 or 4021? Or any other IC or protocol? Would this help? https://m.youtube.com/watch?v=nXl4fb_LbcI Same guy has several other videos on shift registers, I found them informative E: He addresses the using analogue inputs with different resistors in another video (or maybe this one? I can't remember and I can't watch where I am right now), and brings up the point of what happens when two buttons are pressed at the same time (you get a voltage your program isn't expecting) simplefish fucked around with this message at 20:27 on Mar 29, 2016 |
# ? Mar 29, 2016 20:22 |
|
Sorry for the double post, but I'm quoting on mobileSagebrush posted:Look at how numerical keypads are traditionally read, and the code used to do that. Adafruit has a nice tutorial: https://www.adafruit.com/products/419 This was a helpful suggestion when I asked something similar a few weeks back
|
# ? Mar 29, 2016 20:29 |
|
I'm designing a thing for work that will be 10 test stations that will each be used to test battery life. All 10 stations will be identical. My concern is how to mount all of the electronics and make it look decent. Each test station will have an Arduino Uno, 16x2 LCD, prototype board, and a couple buttons and LEDs. There are other components (power supply, load, battery dock) that will be external to the housing and I already have that figured out. Any suggestions on some type of large project box that is wall mountable that can hold all this stuff and be machinable so I can mount the LCDs? I have the tools to machine plastic and could probably do aluminum or steel if I had to, but plastic would be best. It will be located in the service area at my work, so it doesn't have to look amazing, but I'd like it to be a little more professional looking than a bunch of poo poo screwed to a piece of plywood. edit: One box would be preferred, but not critical - 2 boxes with 5 units each, or 10 individual boxes would also work if I had a way to mount them to the wall. Skunkduster fucked around with this message at 23:30 on Apr 1, 2016 |
# ? Apr 1, 2016 23:26 |
|
What tools do you have access to? If you can make straight cuts on plastic pieces, you could make your own box out of acrylic panels by cementing them together at the corners. Try something like this: http://makezine.com/projects/tape-hinge-acrylic-box-construction/ You can get acrylic in a wide range of colors and thicknesses, so you can get the effect you want. You can also drill holes for buttons, etc. and panel-mount them. Look up some tutorials if you're going to do this, as acrylic is brittle and can split, but it's a well established strategy for low-run things like this.
|
# ? Apr 2, 2016 07:33 |
|
SkunkDuster posted:I'm designing a thing for work that will be 10 test stations that will each be used to test battery life. All 10 stations will be identical. My concern is how to mount all of the electronics and make it look decent. Each test station will have an Arduino Uno, 16x2 LCD, prototype board, and a couple buttons and LEDs. There are other components (power supply, load, battery dock) that will be external to the housing and I already have that figured out. Any suggestions on some type of large project box that is wall mountable that can hold all this stuff and be machinable so I can mount the LCDs? I have the tools to machine plastic and could probably do aluminum or steel if I had to, but plastic would be best. It will be located in the service area at my work, so it doesn't have to look amazing, but I'd like it to be a little more professional looking than a bunch of poo poo screwed to a piece of plywood. Like Sagebrush said you can build your own or there's a lot of project boxes available online. They're not as cheap as you'd think but I've bought some Hammond ones from amazon that were pretty easy to cut and drill into to make spots for keypads/LEDs/switches. I mostly used a drill, coping saw and files. The main thing is to get an idea of the layout of the insides and measure them for an enclosure. Putting them in the enclosure you can use almost anything but someone with more experience may have better suggestions than I do. Nylon standoffs are what I've mostly used with a little hot glue, but don't overdo it. I've also cut up some old cd jewel cases for random bits of mounting plasti. If you leave enough space you can screw them to the wall from inside the box, or you can buy some with ears and mounting holes. It's not too hard to make it look nice as long as you don't gently caress up the surface of the box and label the switches and lights.
|
# ? Apr 2, 2016 08:44 |
|
I'm a big fan of the CMB boxes by Bud Industries, I use them a lot for one-off controllers at work: http://www.budind.com/view/NEMA+Boxes/NEMA+4X+With+Mounting+Brackets External mounting tabs are nice, and I'm a big dork for clear lids. I'd be happy to hear other tool suggestions like Rexxed gave, but I use a diamond cutting blade on a dremel tool when I can. Another good strategy for rectangles is to drill a series of perforations to make an outline which is much easier to cut. The trick with ABS is to try and avoid too much friction/heat. I like the suggestion of acrylic enclosures too - something like what Phidgets uses: It's a laser-cut flat pack pattern that slots together. You could then use fluid to bond it together where desired. You'd need to design it yourself though, and find somebody to cut it I bet, so that might not be economical. I just saw them recently and thought they were really clever
|
# ? Apr 2, 2016 15:02 |
|
I have a few questions: 1. I replaced the potentiometer with a resistor on my LCD screen and it worked fine until I tried different power sources - 3V from 2AA and 6V from a wall wart. I'm guessing the difference in voltage as compared to the arduino's 5V is causing the issue? If so am I going to have to use the potentiometer if I plan to switch between power sources? 2. I've run out of memory using my arduino with libraries for an SD card read, LCD screen, and Arducam camera. How easy/hard would it be to go in and start removing chunks of code to safe some space? 3. My arduino camera I designed sometimes randomly fails/resets itself after taking several hundred pictures. What would be the best method to troubleshoot something that happens randomly minutes/hours running? My first thought is to create a text file that records all the inputs I sent to the camera (# of pictures, duration to shoot) and record each time a picture is taken, the current time, and then eventually it'll fail and that'll be the end of my text file. huhu fucked around with this message at 16:38 on Apr 5, 2016 |
# ? Apr 5, 2016 16:11 |
|
Why not go 4AA for 6V, then try to make 6V work?
|
# ? Apr 5, 2016 17:40 |
|
huhu posted:1. I replaced the potentiometer with a resistor on my LCD screen and it worked fine until I tried different power sources - 3V from 2AA and 6V from a wall wart. I'm guessing the difference in voltage as compared to the arduino's 5V is causing the issue? If so am I going to have to use the potentiometer if I plan to switch between power sources? quote:2. I've run out of memory using my arduino with libraries for an SD card read, LCD screen, and Arducam camera. How easy/hard would it be to go in and start removing chunks of code to safe some space? quote:3. My arduino camera I designed sometimes randomly fails/resets itself after taking several hundred pictures. What would be the best method to troubleshoot something that happens randomly minutes/hours running? My first thought is to create a text file that records all the inputs I sent to the camera (# of pictures, duration to shoot) and record each time a picture is taken, the current time, and then eventually it'll fail and that'll be the end of my text file.
|
# ? Apr 5, 2016 21:55 |
|
huhu posted:3. My arduino camera I designed sometimes randomly fails/resets itself after taking several hundred pictures. What would be the best method to troubleshoot something that happens randomly minutes/hours running? My first thought is to create a text file that records all the inputs I sent to the camera (# of pictures, duration to shoot) and record each time a picture is taken, the current time, and then eventually it'll fail and that'll be the end of my text file. A few approaches to consider: 1) Reboot the camera for every picture. If your duty cycle is low enough and the init doesn't draw exceptional power, just resetting the peripheral to a know good state every time might work. I'd be curious if that actually solves it or if there's some other marginal condition that's 2) Poll registers. Print out every value you can get to on every iteration. Use the setup you describe to detect when the camera goes bad and look for something that correlates with that moment. Then you'd code a loop that checked for Register X to have Value Y (i.e. chipID = 0xffff) and reboot the part when that condition is detected. 3) Time it out. See how long a 'good' picture takes. See how long the failing one takes. If there's a consistent enough difference, use that to determine when to reboot the peripheral. 4) LA. Watch transactions, figure out a way to trigger on the bad one, see what's happening at that level when things go off the rails. Building off Captain Cool's suggestion, trigger on a reset at the 99% mark should capture failing traffic. So 1 is a mix between problem/solution, 2 and 3 are both solution space, 4 is pure problem space.
|
# ? Apr 5, 2016 23:24 |
|
Rexxed posted:Like Sagebrush said you can build your own or there's a lot of project boxes available online. They're not as cheap as you'd think but I've bought some Hammond ones from amazon that were pretty easy to cut and drill into to make spots for keypads/LEDs/switches. I mostly used a drill, coping saw and files. The main thing is to get an idea of the layout of the insides and measure them for an enclosure. Putting them in the enclosure you can use almost anything but someone with more experience may have better suggestions than I do. Nylon standoffs are what I've mostly used with a little hot glue, but don't overdo it. I've also cut up some old cd jewel cases for random bits of mounting plasti. If you leave enough space you can screw them to the wall from inside the box, or you can buy some with ears and mounting holes. It's not too hard to make it look nice as long as you don't gently caress up the surface of the box and label the switches and lights. I was looking at the boxes from Hammond and couldn't find anything large enough. Even though I do have the tools to cut and build with acrylic, I'm not too keen on doing that because this is something for work and I'd rather just have the company buy a finished box - I'm paid salary, so if I built it at home, it would be outside my work hours and I wouldn't be getting paid for it. I was sitting at my desk today thinking about it and spotted the fire extinguisher cabinet mounted on the wall and found my answer
|
# ? Apr 7, 2016 02:28 |
|
Arduino Uno questions:code:
2. I'm working on a project that uses a 4 hour timer. Accuracy is not that important +/- 5 minutes is fine. Do I need the Arduino board for timing, or can I pull the Atmega chip off and solder it directly to a prototype board after I load the code? 3. Is there a way to set the pins according to the physical pins of the chip instead of the board numbers? For example, if I was using the Uno board and I wanted pin 10 to be an output, I would write... code:
4. If I have 3 functions in my loop, A, B, and C, is there a way to exclude functions until a condition is met? For example, I'd like to have 'A' say "if button 1 is pressed, loop function B and only function B". 'B' would would say "if button 2 is pressed go to Function C and loop that, if button 3 is pressed go back to function A". I'm assuming it can be done, but I don't even know what to Google search for to get me headed in the right direction to figure it out. If anybody remembers BASIC, I'm looking for the equivalent of the GOTO command. Skunkduster fucked around with this message at 04:23 on Apr 8, 2016 |
# ? Apr 8, 2016 04:21 |
|
SkunkDuster posted:Arduino Uno questions: 2. You can setup something like this to keep time: https://www.arduino.cc/en/Tutorial/ArduinoToBreadboard 3. What is your reasoning for this? 4. Little confused by your question, but you could do: code:
code:
huhu fucked around with this message at 05:02 on Apr 8, 2016 |
# ? Apr 8, 2016 04:59 |
|
SkunkDuster posted:Arduino Uno questions: 1. That "line of code" is a variable declaration in C++, it's "code outside of a loop/function" in only the strictest and most basic sense of the term, but just fine in a high-level object-oriented language. 2. Yes. Look into fuse bits and using the internal clock, and realize that you're at half or quarter Arduino clock speed. 3. Learn #define and .h files with #include, and love them. If this makes literally no sense at all, read up on "C" programming language 4. If you're looking for BASIC's GOTO, then you need C's switch() C code:
|
# ? Apr 9, 2016 03:48 |
|
huhu posted:1. One reason is that declaring variables outside of setup() or loop() causes them to become global variables. If you don't know what global variables are I'd read up on global vs local variables. 1. I don't know what global variables are, but now that I know what they are called, I can learn about them. 2. Thanks. I'm going to have to look into this. It would make the project cleaner if I could use one prototype board for all the components instead of a bunch of jumper wires from the Arduino over to the prototype board. 3. It seemed to make more sense to me that if I was using the chip as a standalone to write the code for the pins of the chip instead of the breakouts on the Arduino that wouldn't be part of the circuit. I'm very new to this, so maybe I am misunderstanding some basic concepts. 4. The second example should get me on the right track. The code will go through 5 stages. Depending on what stage it is in, I need button 1 to do different things. I don't know the syntax well enough to write from scratch so I rely on finding examples and modifying them, but this is the logical concept of what I am after: code:
|
# ? Apr 9, 2016 04:01 |
|
|
# ? May 29, 2024 11:24 |
|
SkunkDuster posted:4. The second example should get me on the right track. The code will go through 5 stages. Depending on what stage it is in, I need button 1 to do different things. I don't know the syntax well enough to write from scratch so I rely on finding examples and modifying them, but this is the logical concept of what I am after:
|
# ? Apr 9, 2016 04:29 |