Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
JawnV6
Jul 4, 2004

So hot ...

simplefish posted:

A few years ago I had a PCB etching kit that used a sharpie to draw the tracks then you dipped the whole thing in ferric chloride. At least, I think that was how it worked. Anyway just look for a PCB etching kit.
I don't think that will give significantly better results than stuffing the existing breadboards into a box with hot glue.

Rapulum_Dei posted:

im sure I saw a cheap service to get small amounts of pcb designs printed and delivered.
http://pcbshopper.com ?

Adbot
ADBOT LOVES YOU

simplefish
Mar 28, 2011

So long, and thanks for all the fish gallbladdΣrs!


You can save space. It's not pro level obviously and it's only really for one-offs but it does away with the whole photoresists step and gave good, functional results that you can solder onto

Aurium
Oct 10, 2010
I really like etching my own boards. I can get it to look about as good as the boards you find in white goods.

But I'm super weird and impatient.

UberVexer
Jan 5, 2006

I like trains

Rapulum_Dei posted:

im sure I saw a cheap service to get small amounts of pcb designs printed and delivered.

oshpark is the one that comes to mind immediately.


First Time Caller posted:

Question: What resources should I look at for figuring out how to design a PCB so I can fit this into a small box?

Go download Eagle and watch some tutorials. Eagle is free for hobbyists. Altium has a free hobbyist program out now also, but I haven't seen much about it.

https://www.youtube.com/watch?v=NJKZZArjdg8

https://www.youtube.com/watch?v=JANZsjRiM3w

This dude makes some pretty good videos about best practices.

politicorific
Sep 15, 2007
I thought I'd try to see if anyone else has built a Sous Vide cooker yet. I'm building one for a Something Awful BBQ. I've got the project about 40% assembled.

https://learn.adafruit.com/sous-vide-powered-by-arduino-the-sous-viduino/sous-vide

I haven't attempted to modify the code yet. Hopefully someone can offer me some guidance.
The Adafruit implementation uses a $30 RGB LCD+button shield and other expensive parts which are kind of wasteful. I've replaced these with cheaper options.

Here are my list of substitutions:
1) An arduino nano knockoff.
2) A regular 1602 LCD.
3) A self-built 5 button controller which I plan on connecting to the analog pins and use in digital mode.
4) An RGB LED to replicate the 4 colors used to indicate the PID status.

I have a DS18B20 temperature sensor and a Keyes 2 channel relay.
I've also purchased 2 500 watt heating elements. I've already played with a sketch I wrote to poll the temperature, operate the relays, and update the LCD.
2x 5 volt 1 amp USB adapters, 1 for the arduino, 1 for the 2 channel relay.
No PCBs for this, I'll just perfboard since the schematic is pretty simple.

A re-purposed project box.

What I see as issues:

Pin Count. The Arduino Nano has 11 digital pins and 8 analog pins. No PWM is required for this project, for the RGB LED I'm okay with 9 combinations of colors. I also have i2c lcd backpacks and i2c 8 gpio extenders available if I run low on pins.

1602 LCD - 6 pins required (RS, E, + 4 Data pins)
DS18B20 temperature sensor - 1 pin required
5 buttons - 5 pins, use analog pins.
Keyes 2 channel relay - 1 pin (output doubled to both channels).


For grand total of 11 pins. Looks like I have enough. Also the adafruit sous vide code does stupid things like this:
code:
// One-Wire Temperature Sensor
// (Use GPIO pins for power/ground to simplify the wiring)
#define ONE_WIRE_BUS 2
#define ONE_WIRE_PWR 3
#define ONE_WIRE_GND 4
Memory/coding issues
Since I'm not using that expensive LCD, I can dump the Adafruit_MCP23017.h library, but I need to redefine my buttons in the code. The same include goes for the Adafruit_RGBLCDShield.h libary which I plan on replacing with the LiquidCrystal.h library. Are there any guides out there on how to best accomplish this? If I run out of memory, I've read that I can hack out parts of the LiquidCrystal library to remove parts I won't use.

Here's the RGB backlight section of the code, so wasteful; an RGB LED will do.
code:
{
   if (tuning)
   {
      lcd.setBacklight(VIOLET); // Tuning Mode
   }
   else if (abs(Input - Setpoint) > 1.0)  
   {
      lcd.setBacklight(RED);  // High Alarm - off by more than 1 degree
   }
   else if (abs(Input - Setpoint) > 0.2)  
   {
      lcd.setBacklight(YELLOW);  // Low Alarm - off by more than 0.2 degrees
   }
   else
   {
      lcd.setBacklight(WHITE);  // We're on target!
   }
}
Is there anything else I'm forgetting?

Sagebrush
Feb 26, 2012

One of my students built a sous-vide using that same tutorial. Reportedly it works fine.

It's kind of ironic that you've called the Adafruit LCD "wasteful" when it specifically uses I2C to drastically reduce the pin count required, which is an issue you're concerned about. You can use the port expanders and LCD backpacks you've got, yes...but then you're basically just making your own version of the Adafruit shield. Their stuff is a little more expensive than Aliexpress, yeah, but it's good quality.

There aren't going to be guides on how to refactor code in the specific way you're looking for. You need to first write your own button handler, then look through the sous-vide code, find the parts that rely on the Adafruit button system, and replace all the references with calls to your new code. How that looks will depend on how your handler works.

This

code:
// One-Wire Temperature Sensor
// (Use GPIO pins for power/ground to simplify the wiring)
#define ONE_WIRE_BUS 2
#define ONE_WIRE_PWR 3
#define ONE_WIRE_GND 4
is not "stupid", it's convenient and effective . Defining constants that way makes it easy to update the pin numbers if you need to change the circuit layout (or if you swap to a different microcontroller), but because it's a preprocessor directive it doesn't use any of your RAM. It's an extremely common practice in microcontroller programming.

The RGB backlight section also isn't "wasteful" per se. It's almost certainly making calls to code that's very similar to what you're going to have to write to control the LED you're replacing it with. You're unlikely to run out of space unless you're adding a ton of new features, anyway, so there's no real reason to strip out stuff immediately to try and pre-empt that. Any libraries that are included in the sketch but not actually called in the code will be optimized out by the compiler.

politicorific
Sep 15, 2007
The part I find dumb is using an expensive part to use 1% of its functionality. $adafruit$

Captain Hair
Dec 31, 2007

Of course, that can backfire... some men like their bitches crazy.
So my current project is at the point where I'm adding buttons. No two buttons will ever need to be pressed at the same time, but I'll need about 10 buttons. It's basically a weather station but for a snake vivarium.

I've been reading about various ways of doing it and was thinking about using 5 buttons per analogue input each with a different resistor. But a lot of people say that's a bad idea long term as the resistors will fail also that heat/cold can throw off the readings enough that the buttons don't send the correct reading to register.

Anyone like to give me an opinion on that? Also if it is a poor idea, is my next best option an i2c setup?

evil_bunnY
Apr 2, 2003

rotary encoder and a normally open button.

Captain Hair
Dec 31, 2007

Of course, that can backfire... some men like their bitches crazy.
As genius as that is I really need all ten buttons easily available. It's running a couple of lcds so I did consider using an lcd keypad with osd, but it's much simpler for my user if she just has all options available as buttons.

I think I'll just go the resistor per button route, maybe make up a spare board that she can swap out in future if a button fails. :)

One Legged Ninja
Sep 19, 2007
Feared by shoe salesmen. Defeated by chest-high walls.
Fun Shoe
If you have a few pins available, how about a button matrix? It's more efficient for a larger number of buttons, of course, but you could go from 10 pins to 7, at least. (5x2, 3x4, 3x3 + 1, etc) Plus you can in fact press more than one button if you use diodes.

evil_bunnY
Apr 2, 2003

Captain Hair posted:

As genius as that is I really need all ten buttons easily available. It's running a couple of lcds so I did consider using an lcd keypad with osd, but it's much simpler for my user if she just has all options available as buttons.
FOUR DOLLAH

https://www.adafruit.com/product/419

babyeatingpsychopath
Oct 28, 2000
Forum Veteran


Captain Hair posted:

As genius as that is I really need all ten buttons easily available. It's running a couple of lcds so I did consider using an lcd keypad with osd, but it's much simpler for my user if she just has all options available as buttons.

I think I'll just go the resistor per button route, maybe make up a spare board that she can swap out in future if a button fails. :)

You can get to 4 pins with charlieplexing if you like diodes.
edit: you can use (n * (n-1)) buttons with n pins. 3 pins = 6 buttons, 4 pins = 12 buttons, 5 pins = 20 buttons. If you use LEDs as your charlieplexing diodes, you get lit buttons for free. You don't even (necessarily) need to put a button on a state; you can just have a diode there, and if you want it on, then put it in your polling loop.

babyeatingpsychopath fucked around with this message at 02:25 on Aug 13, 2016

General_Failure
Apr 17, 2005
I mentioned it in passing in the magic smoke thread but I'm putting some hard labour into getting one of those little red fan modules working again for my little boy. A few days ago his Arduino Uno refused to turn the fan again beyond a twitch. I had a look at it today and the 5v regulator seemed to gave gotten flaky in a weird way. Any load seemed to result in a pretty good short circuit between VIn and GND. It still seemed to function on it's own but just using USB in avoided the bad smell :( I modified the proto / breadboard shield we were using to have a 5v linear regulator and input but it was too little too late. RIP Uno.

So I've given him mine essentially and I've been hard at work trying to get one of the damned fan modules to work properly.



Here's where I'm at. The only thing the Arduino really does is toggle one of the inputs to the H bridge when the button is pressed.

It took the 4700uF cap to get the fan to start properly instead of a rapid reboot loop as the uC got curbstomped by the startup current of the fan. The regulator gets hot too. What the hell sort of fan is this???
So before I hand it over I'm going to have to change the "debounce" example sketch (OK I was being lazy) to use PWM for an acceleration curve and perhaps cap it at about 80% duty. Thoughts?

I wasn't testing it on the stainless bench so don't worry. I'm not quite that silly, usually.

babyeatingpsychopath
Oct 28, 2000
Forum Veteran


General_Failure posted:

I mentioned it in passing in the magic smoke thread but I'm putting some hard labour into getting one of those little red fan modules working again for my little boy. A few days ago his Arduino Uno refused to turn the fan again beyond a twitch. I had a look at it today and the 5v regulator seemed to gave gotten flaky in a weird way. Any load seemed to result in a pretty good short circuit between VIn and GND. It still seemed to function on it's own but just using USB in avoided the bad smell :( I modified the proto / breadboard shield we were using to have a 5v linear regulator and input but it was too little too late. RIP Uno.

So I've given him mine essentially and I've been hard at work trying to get one of the damned fan modules to work properly.



Here's where I'm at. The only thing the Arduino really does is toggle one of the inputs to the H bridge when the button is pressed.

It took the 4700uF cap to get the fan to start properly instead of a rapid reboot loop as the uC got curbstomped by the startup current of the fan. The regulator gets hot too. What the hell sort of fan is this???
So before I hand it over I'm going to have to change the "debounce" example sketch (OK I was being lazy) to use PWM for an acceleration curve and perhaps cap it at about 80% duty. Thoughts?

I wasn't testing it on the stainless bench so don't worry. I'm not quite that silly, usually.

Why not power the h-bridge from a completely separate 5V supply and not run all that current through the dev board and its linear regulator?

Captain Hair
Dec 31, 2007

Of course, that can backfire... some men like their bitches crazy.
Cheers guys, really digging the charlieplexing and the button matrix ideas. It's ridiculous how much complicated stuff I've managed to learn and yet I got stumped by button setups. I think I'll play around with a few options, see what works best :)

Plus it's an excuse to buy more components, can never have too many. Going to pick up a 8574 i2c port expander I think also, I really like working with i2c so that might also work as a solution for my buttons.

ArcticZombie
Sep 15, 2010

Sagebrush posted:

I personally would use something like an NRF24L01 module in that case. Cheap and effective, and you don't have to deal with all the headaches that bluetooth creates.

Finally got some of these and set them up. They work almost perfectly. Almost.

I'm using the RF24 library for getting these things to communicate and for the most part it works fine. The write() method returns a bool if the radio successfully transmitted the payload or not, handy for retransmitting a failure as it's important that the payload gets through so the base unit knows that the door has been opened (or that a valid RFID tag has been presented). However, when the RFID reader (specifically an Innovations ID-12LA) is plugged in, write() always returns false. The payload is being transmitted (the other unit is receiving it and acting accordingly), but for some reason the sending unit doesn't think it is successful. It works prefectly fine without the ID-12LA plugged in. What could be causing this?

I know an easy way around this is to have the base unit send back an acknowledgement packet and ignore the output of write(), but there is potentially going to be more sensor nodes talking to the base unit and I was hoping to keep them strictly transmit only with the base unit receiving for simplicity.

Here it is on a breadboard. I don't think interference is an issue as the packet is being received just fine and the 2 components aren't that close to one another.

ArcticZombie fucked around with this message at 17:08 on Aug 16, 2016

Sagebrush
Feb 26, 2012

Signal line confusion maybe? Don't both the NRF module and the RFID unit use a serial connection?

General_Failure
Apr 17, 2005

babyeatingpsychopath posted:

Why not power the h-bridge from a completely separate 5V supply and not run all that current through the dev board and its linear regulator?

I guess my reply got lost in the ether.

What I said essentially was that I didn't think of that for some reason. It's why asking questions is a good thing.


Now I also spotted "Arm cortex-m3 stm32f103c8t6 stm32 core board" on Aliexpress for $USD5.14. Are these worth looking at? I mean do they stand out in any practical terms?

ArcticZombie
Sep 15, 2010

Sagebrush posted:

Signal line confusion maybe? Don't both the NRF module and the RFID unit use a serial connection?

I believe so, the datasheet for the RFID unit says it has different data formats. Do you think if I used the magnetic emulation format this would be avoided?

I tested it with the base unit sending back acknowledgement packets and the door unit never receives the acknowledgements. I then noticed that the RF24 library has acknowledgement packets builtin, which is how it knows if a write() was successful or not in the first place :downs:. It also has some auto-retry functionality that can be enabled, but using this has the same result as retrying manually. The unit seems unable to recieve packets when the RFID unit is plugged in.

Further testing revealed that sometimes, if I power up the circuit without the RFID unit and plug it in after the first payload has been sent, subsequent payloads transmit successfully.

edmund745
Jun 5, 2010

Captain Hair posted:

As genius as that is I really need all ten buttons easily available. It's running a couple of lcds so I did consider using an lcd keypad with osd, but it's much simpler for my user if she just has all options available as buttons.

I think I'll just go the resistor per button route, maybe make up a spare board that she can swap out in future if a button fails. :)
I don't think you'd have a problem if you used 1% metal-film resistors bought from somewhere reliable (the China ones are fakes)

You can also use one of the 16-channel mux/demux boards if you have 5 pins on the arduino available.
You have to write code to scan through all the buttons occasionally (every second or whatever) but this would allow up to 16 buttons.

Usually these use the CD74HC4067 chip. Sparkfun's is $5, but they're available from lots of places including china-land (lower price w/longer shipping times)

Methanar
Sep 26, 2013

by the sex ghost
I'm trying to burn a hex file ontop an Arduino Mega 2560 with AVRdude from a Mac and I really don't know what I'm doing. I ran this once and it worked and now my Arduino seems pretty bricked. When I restart it the L led is supposed to flash to indicate a bootloader being present but it doesn't.

What did I do, how do I fix it and make my hex file properly write?

code:
avrdude -p m2560 -c stk500v2 -P /dev/cu.usbmodem1411 -b 115200 -F -U flash:w:/Arduino/Rabbit/Rabbit.ino.with_bootloader.mega.hex:i

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e9801
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "/Arduino/Rabbit/Rabbit.ino.with_bootloader.mega.hex"
avrdude: writing flash (261406 bytes):

Writing | ################################################## | 100% 0.82s

avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout 

Methanar fucked around with this message at 05:14 on Aug 22, 2016

politicorific
Sep 15, 2007
Hey everyone,

I finished my Sous Vide, take a look:

http://imgur.com/a/jDocW

Methanar
Sep 26, 2013

by the sex ghost

Methanar posted:

I'm trying to burn a hex file ontop an Arduino Mega 2560 with AVRdude from a Mac and I really don't know what I'm doing. I ran this once and it worked and now my Arduino seems pretty bricked. When I restart it the L led is supposed to flash to indicate a bootloader being present but it doesn't.

What did I do, how do I fix it and make my hex file properly write?

code:
avrdude -p m2560 -c stk500v2 -P /dev/cu.usbmodem1411 -b 115200 -F -U flash:w:/Arduino/Rabbit/Rabbit.ino.with_bootloader.mega.hex:i

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e9801
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "/Arduino/Rabbit/Rabbit.ino.with_bootloader.mega.hex"
avrdude: writing flash (261406 bytes):

Writing | ################################################## | 100% 0.82s

avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout 

Addendum to this: I've somehow managed to destroy the bootloader. What equipment do I actually to program via ISCP? I've been looking for how these stupid things work for 2 hours and I'm really not understanding it. Where do I even get a bootloader file? Supposedly the image I was given to put on these things contains a bootloader per the name. Will burning that through ISCP do what I want?

General_Failure
Apr 17, 2005
Not sure if I posted this. Just a little warning to save a couple of bucks, time and a lot of frustration.
Don't get the esp8266 arduino uno format D1 unless it's an R2.
For some reason they didn't break out half the pins and just duplicated most of the ones that they did.
I just use the stupid thing for testing new hardware like i2c, serial and SPI stuff.
I mean the Arduino board format is only really any good for trying things anyway but if there's not really much usable IO it's pretty much pointless.

Sagebrush
Feb 26, 2012

Methanar posted:

Addendum to this: I've somehow managed to destroy the bootloader. What equipment do I actually to program via ISCP? I've been looking for how these stupid things work for 2 hours and I'm really not understanding it. Where do I even get a bootloader file? Supposedly the image I was given to put on these things contains a bootloader per the name. Will burning that through ISCP do what I want?

Are you trying to reprogram an Arduino Mega?

You need to either get an ICSP programmer, or a second Arduino programmed with the ISP sketch. Connect the six ICSP pins to the correct locations on each board/programmer (there are diagrams online, the specific ones will vary depending on what you have). Then load up the Arduino IDE, set the board type to the target board (Mega), the serial port to whatever your programmer is connected to, the Tools > Programmer menu to the type of programmer you're using, and choose "burn bootloader." That will rewrite the Arduino bootloader onto the target board and fix any broken fuse settings, assuming the board isn't totally bricked for some other reason.

If you want to burn a different bootloader, then you'll need that .hex file and you'll need to go through AVRdude.

Methanar
Sep 26, 2013

by the sex ghost
Yeah it's an Arduino mega 2560.

I guess some background for what I'm doing would help.

I'm travelling to a datacenter tomorrow for a few days and one of the things I'll be doing is setting up a shitload of Arduinos to do something specific. The one I bricked is just my local test one I don't care too much about it, especially if I need to buy special equipment for it which I wouldn't be able to get before I travel tomorrow anyway.


quote:

If you want to burn a different bootloader, then you'll need that .hex file and you'll need to go through AVRdude.

What is the proper way flashing these things through AVRdude? Clearly whatever I tried for my first attempt didn't work but I don't know why and it's hard to get second chances. Running this command seems to be exactly what every online tutorial suggests. I want to be able to do this over the USB port.
I don't even know what stk500v2 is
code:
avrdude -p m2560 -c stk500v2 -P /dev/cu.usbmodem1411 -b 115200 -F -U flash:w:/Arduino/Rabbit/Rabbit.ino.with_bootloader.mega.hex:i

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e9801
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "/Arduino/Rabbit/Rabbit.ino.with_bootloader.mega.hex"
avrdude: writing flash (261406 bytes):

Writing | ################################################## | 100% 0.82s

avrdude: stk500v2_ReceiveMessage(): timeout

Sagebrush
Feb 26, 2012

The STK500 is an AVR programmer, and that line is telling avrdude what protocol it should use to talk to the programmer when it starts the cycle. Your error is telling you that avrdude can't find an STK500. What programmer are you using? Do you just have your Arduino connected through USB? If the device is currently bricked (i.e. you can't load the basic blink sketch from the examples), then you can't burn any code (including a new bootloader) onto it over the USB port, because the bootloader needs to be running to handle the USB/serial programming. You'll have to use some sort of external programmer that plugs into the chip and writes the hex file directly.

If you have a second Arduino, you can program that to be an ICSP programmer with the "ArduinoISP" sketch that's included in the examples. Otherwise, you'll need to buy an external programmer. I use the USBASP, personally -- they're like $5 on eBay.

mod sassinator
Dec 13, 2006
I came here to Kick Ass and Chew Bubblegum,
and I'm All out of Ass
If you're just trying to flash a bunch of Arduinos with a sketch you built ahead of time over their USB port (and Arduino's built in bootloader), turn on the verbose output for upload in Arduino preferences. Upload a sketch and you'll see in the output the exact avrdude command Arduino ran, for example flashing a blink sketch to an Uno (not a mega!) looks similar to this for me:

avrdude -C/path/to/tools/avr/etc/avrdude.conf -v -patmega328p -carduino -P/dev/cu.usbmodem143411 -b115200 -D -Uflash:w:/var/folders/z9/qr8ygmj979x8972xyyw4spph0000gn/T/builde7cfe7a3980f3b4d926893b43990d21e.tmp/Blink.ino.hex:i

Methanar
Sep 26, 2013

by the sex ghost

Sagebrush posted:

The STK500 is an AVR programmer, and that line is telling avrdude what protocol it should use to talk to the programmer when it starts the cycle. Your error is telling you that avrdude can't find an STK500. What programmer are you using? Do you just have your Arduino connected through USB? If the device is currently bricked (i.e. you can't load the basic blink sketch from the examples), then you can't burn any code (including a new bootloader) onto it over the USB port, because the bootloader needs to be running to handle the USB/serial programming. You'll have to use some sort of external programmer that plugs into the chip and writes the hex file directly.

If you have a second Arduino, you can program that to be an ICSP programmer with the "ArduinoISP" sketch that's included in the examples. Otherwise, you'll need to buy an external programmer. I use the USBASP, personally -- they're like $5 on eBay.

I don't have a programmer and want to avoid using one. It was literally just a USB cable from my computer to the arduino that was it. The one I had been testing on is bricked and I don't have a good way of fixing it but that doesn't matter. I'll have 500 fresh ones starting tomorrow. Assuming I had a fresh out of the box arduino: how can I push my hex file onto it safely with nothing but avrdude and a USB cable. Whatever I did wasn't right.


mod sassinator posted:

If you're just trying to flash a bunch of Arduinos with a sketch you built ahead of time over their USB port (and Arduino's built in bootloader), turn on the verbose output for upload in Arduino preferences. Upload a sketch and you'll see in the output the exact avrdude command Arduino ran, for example flashing a blink sketch to an Uno (not a mega!) looks similar to this for me:

avrdude -C/path/to/tools/avr/etc/avrdude.conf -v -patmega328p -carduino -P/dev/cu.usbmodem143411 -b115200 -D -Uflash:w:/var/folders/z9/qr8ygmj979x8972xyyw4spph0000gn/T/builde7cfe7a3980f3b4d926893b43990d21e.tmp/Blink.ino.hex:i

Is there anything specifically I need to have in AVRdude.conf? Do I need to explicitly call it for some reason?

Do you know what would be different between a mega avr command and uno because yours is very similar to what I ran but mine was pretty fatal.

Sagebrush
Feb 26, 2012

Methanar posted:

Assuming I had a fresh out of the box arduino: how can I push my hex file onto it safely with nothing but avrdude and a USB cable. Whatever I did wasn't right.

XLoader may be the easiest way to pull this off, if the issue is just that you need to burn a .hex file. Point and click.

If you're using avrdude specifically because you want to put it in a shell script or something, then I'd suggest doing what mod sassinator says and checking the verbose output for the exact avrdude command that Arduino calls when you have everything set up for your system, then copying that and modifying the paths accordingly.

I don't have a Mega, unfortunately, so I can't verify that this works, but this is what my IDE spit out when set for a Mega2560:

code:
avrdude -CC:\path\to\arduino\hardware\tools\avr/etc/avrdude.conf -v -patmega2560 -cwiring -PCOM3 -b115200 -D -Uflash:w:C:\path\to\your\code.hex:i 
You'll need to check the paths and the COM port. I don't have a Mac so unfortunately I don't know what those will be for you exactly.

Sagebrush fucked around with this message at 01:57 on Aug 23, 2016

Methanar
Sep 26, 2013

by the sex ghost
wait maybe I fixed it

Methanar fucked around with this message at 20:19 on Aug 24, 2016

First Time Caller
Nov 1, 2004

Can you please tell us what you are going to do in a datacenter with 500 arduinos? I don't know if I can continue living without knowing.

:psyduck:

mod sassinator
Dec 13, 2006
I came here to Kick Ass and Chew Bubblegum,
and I'm All out of Ass

Methanar posted:

Is there anything specifically I need to have in AVRdude.conf? Do I need to explicitly call it for some reason?

Yes use the avrdude.conf that Arduino ships. It has little tweaks and configurations for each chip, stuff like the timing for talking to the bootloader, etc. Open the file and check it out if you're curious.

Methanar
Sep 26, 2013

by the sex ghost
GOT IT!

Now I just need figure out how to properly and systematically enumerate a whole lot of them on single linux server with a pile of USB hubs. At least the dumb electronics part that I'm not familiar with is done. Rest should just be scripting.

First Time Caller posted:

Can you please tell us what you are going to do in a datacenter with 500 arduinos? I don't know if I can continue living without knowing.

:psyduck:

The arduinos are going to be used for a custom power management solution because we have some insane custom hardware configurations that nothing proper would ever work with.

I really appreciate the help. Telling me to use the arduino IDE for a template was very helpful. I still don't understand why my first attempt bricked my demo one but I don't care anymore!

mod sassinator
Dec 13, 2006
I came here to Kick Ass and Chew Bubblegum,
and I'm All out of Ass

Methanar posted:

I really appreciate the help. Telling me to use the arduino IDE for a template was very helpful. I still don't understand why my first attempt bricked my demo one but I don't care anymore!

I think without the -D option it went and erased the entire flash memory, including the bootloader that was burned in and normally not touched when uploading sketches. For whatever reason it couldn't do the flashing after the erase (not totally sure why, it's odd it could erase but not flash) so the board was just left with blank memory. Good you got it working though, good luck!

Sagebrush
Feb 26, 2012

Well, remember that in arduino-mode the chip is always running code (the bootloader), even during the flashing procedure. It probably got as far as wiping out the bootloader, tried to go on to the next step, the processor tried to load the next routine and it crapped out cause it was gone.

Should be able to fix it just fine with a regular ICSP programmer.

UberVexer
Jan 5, 2006

I like trains

Sagebrush posted:

Should be able to fix it just fine with a regular ICSP programmer.

This is true for most Arduino problems.

If you're not messing around with Megas or anything you can grab one of the cheap programmers from Sparkfun or Adafruit, but it's totally worth getting one of the Atmel ICE programmers if you can.

General_Failure
Apr 17, 2005
Just be careful you get an ICSP programmer that actually works. There's a whole stack of them out there with a weird firmware on than that only works with some junky Chinese software.
I've tried and failed to re flash mine a few times. I was going to try again now I have an FTDI adapter but do you think I can find the drat programmer now? Nope.

Adbot
ADBOT LOVES YOU

Star War Sex Parrot
Oct 2, 2003

UberVexer posted:

it's totally worth getting one of the Atmel ICE programmers if you can.
Other than it being a fragile piece of poo poo (I'd say about 50% of the students in my embedded class break the USB port) yeah it's pretty great.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply