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
edmund745
Jun 5, 2010

COOL CORN posted:

Why isn't my LCD doing anything? :saddowns:
I am guessing here... don't have a plain LCD to try testing on. Also, I did not check the wiring, I'm only looking at the code:

1. I would figure the display value before assigning it to the lcd.print() statement. I have had issues with stuff like that in the past. That usually works with PC compilers, or they tell you that you're doing it wrong. Sometimes it will work in the Arduino IDE, other times not, and it doesn't say why. So IMO it is better to not include any math in there--just the variable value to show, that is already computed.

2. LCDs don't update instantly--they need some time to change their display and you don't have any time delays in there. You are trying to update the LCD as fast as the main sketch loop runs, which is probably tens of thousands of times a second. An LCD probably needs at least 1/10th of a second to update, and some can take as long as half a second to update.

code:
#include <LiquidCrystal.h>

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
unsigned long displayTime; // ---------------------- added

void setup() {
  lcd.begin(16, 2);  
  lcd.setCursor(0, 0); // ---------------------- added an initialization to known-valid values
  lcd.print("hello, world!");
  delay(3000); // ---------------------- added
}

void loop() {
  lcd.setCursor(0, 1);
  displayTime = millis() / 1000; // ---------------------- added
  lcd.print(displayTime); // ---------------------- changed to remove the math to the preceding line
  delay(1000); // ---------------------- added
}

edmund745 fucked around with this message at 16:10 on Jun 9, 2016

Adbot
ADBOT LOVES YOU

Count Thrashula
Jun 1, 2003

Death is nothing compared to vindication.
Buglord
I think part of my LCD issue is a bug in Autodesk's 123D environment. Really cool site for prototyping, but... others are reporting problems with the LCD module. Even when I copy everything straight over from a known-good module, it doesn't work.

edmund745
Jun 5, 2010

COOL CORN posted:

I think part of my LCD issue is a bug in Autodesk's 123D environment. Really cool site for prototyping, but... others are reporting problems with the LCD module. Even when I copy everything straight over from a known-good module, it doesn't work.
The real ones have always worked for me.

A China clone Nano costs about $1.60, a 16x2 LCD costs about $1.60. The plain LCD uses a lot of pins tho; an LCD with I2C backpack board costs about $2.10.

I2C lines (and SPI lines too!) must be kept short to work; the shorter the better. 6 inches is "long".

Note that some of those "bare" LCDs are 3.3v while some are 5v. If you want to use them directly (parallel) then you need the LCD's input voltage to match the arduino board's logic level. The Nano is 5v only I think, but you can get Pro Mini clones for $1.50 in either 3.3v or 5v........

The PCF8574 I2C chip used on the backpack boards can run on 2.5 to 6v, so it can run either LCD if you give the backpack board the right voltage.

huhu
Feb 24, 2006
Kind of a weird question... I'm writing some code today in Arduino, referencing Google as usual and the search results seem to be complete garbage and not helpful today. I feel like I've never clicked more than 1 or 2 links for basic answers and I cannot figure out any of my issues.

I should point out I've Googled similar issues in the past just fine.

Full Circle
Feb 20, 2008

huhu posted:

Kind of a weird question... I'm writing some code today in Arduino, referencing Google as usual and the search results seem to be complete garbage and not helpful today. I feel like I've never clicked more than 1 or 2 links for basic answers and I cannot figure out any of my issues.

I should point out I've Googled similar issues in the past just fine.

If you open a private/incognito window do the searches get better?

huhu
Feb 24, 2006

Full Circle posted:

If you open a private/incognito window do the searches get better?

I realized the stuff I've found in the past was for Python and arduino doesn't support the code I'd thought of.

huhu
Feb 24, 2006
I have a setup that includes two servos and an LCD screen running off an arduino pro mini. One of the two servos randomly shakes and also messes with the LCD screen sometimes causing it to go to gibberish. Any ideas?

evil_bunnY
Apr 2, 2003

Is it always the same servo? How's you power situation? It's screwy when only the bad servo's powered?

huhu
Feb 24, 2006

evil_bunnY posted:

Is it always the same servo? How's you power situation? It's screwy when only the bad servo's powered?

It's always the same servo. I've got a 5V through FTDI powering 2 mini servos and an LCD screen. I used the example sweep sketch. Tested each servo to do 180 sweep in each direction then delay for 15000ms. Then I tested both together. The servo didn't twitch during the 15000ms delay.

Edit: After reuploading the sketch they're both twitching.

huhu fucked around with this message at 20:42 on Jun 14, 2016

Dynamite Dog
Dec 12, 2012

That sounds like power to me. How much current are your servos supposed to pull?

According to this you have less than 100mA to use from the pro mini - http://forum.arduino.cc/index.php?topic=18393.0

mod sassinator
Dec 13, 2006
I came here to Kick Ass and Chew Bubblegum,
and I'm All out of Ass
Grab a 4x AA battery pack and use that to power the servos. Just make sure to connect the battery pack ground to an Arduino ground so they're at the same level and the servos can read the pulses from the Arduino. Trying to power both servos and other things all from the mini's little regulator or even your computer's USB port just won't cut it unfortunately. When a servo gets stuck it can sometimes pull up to an amp of current alone.

huhu
Feb 24, 2006
drat. I shoot have noted this issue before I soldered everything together and built a box for it all. Thanks for the advise, I'll have to figure out how to add an additional battery pack to the design. I've got a battery pack I was hoping to do this all with. It has 2 USB ports on it. could I wire one port up to the FTDI chip and then splice a USB cable and run that to the servos?

Edit: Will the servos get more torque if I wire them directly to the battery pack?

My lcd screen also randomly converts to just displaying gibberish. Would this be a power issue as well?

huhu fucked around with this message at 22:42 on Jun 14, 2016

Hadlock
Nov 9, 2004

You may be able to solider in a 5v ultracapacitor. You can buy them on eBay, usually packaged as a dual 2.7v capacitor. That's sometimes enough to smooth out power draw for the batteries. They're also tiny.

Often when components start behaving erratically it's due to a low power drop out.

Hadlock fucked around with this message at 22:54 on Jun 14, 2016

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

huhu posted:

My lcd screen also randomly converts to just displaying gibberish. Would this be a power issue as well?

Definitely, if the servos draw too much current the voltage from the supply can drop down to a low enough level that it resets the LCD or gets it very confused about the signals coming in.

evil_bunnY
Apr 2, 2003

huhu posted:

drat. I shoot have noted this issue before I soldered everything together and built a box for it all. Thanks for the advise, I'll have to figure out how to add an additional battery pack to the design. I've got a battery pack I was hoping to do this all with. It has 2 USB ports on it. could I wire one port up to the FTDI chip and then splice a USB cable and run that to the servos?

Edit: Will the servos get more torque if I wire them directly to the battery pack?
Each port should deliver at elast 500mA so yes, powering each device from its own port will help.

Data Graham
Dec 28, 2009

📈📊🍪😋



A childhood buddy of mine just launched an autonomous solar oceangoing boat:

http://www.seacharger.com

It's running a Mega, and I helped out with some code issues :woop:

On its way to Hawaii right now.

Normal Barbarian
Nov 24, 2006

I needed to know what sort of PWM to use with my servos and motors, so I cleared off the dining room table and did some ROBOSCIENCE. :science:

I played around with my multimeter while I downloaded the Arduino IDE. Red to black measured roughly 5.5 V. Servo signal to black was 327mV, 250mV, and 173 mV at left/ccw, center, and right/cw, respectively. Neat.



Download complete, I loaded the pulseIn() code from http://www.benripley.com/diy/arduino/three-ways-to-read-a-pwm-signal-with-arduino/ and went to town. The Arduino recorded ~1964 at leftmost, ~1490 at neutral, ~1026 at rightmost. Note that this does not represent the full range of the servo, but the physical limits of the crawler's steering with the center shifted to make up for the servo horn's alignment.

Next up: Motors!



I got outsmarted by the receiver. It sent a burst of pulses, beeped at me, then stopped. I didn't want to connect it to the ESC because I didn't want the wheels to turn, but, alas, so it goes. It worked once everything was hooked up.



Full forward: 2090. Neutral deadband from ~1570 to ~1420. Full reverse, 900. Roughly 520 of territory between deadband and maximum. Mission accomplished. :toot:

It just occurred to me that I should've also measured currents. OH WELL.

Normal Barbarian fucked around with this message at 00:49 on Jun 16, 2016

Normal Barbarian
Nov 24, 2006

After looking up the PWM math and what, exactly, pulseIn() does, it seems that I have a bit more work to do before I can turn those measurements into something useful. Still, it's a start. :)

Hadlock
Nov 9, 2004

The ESP8266 is getting a slightly bigger brother, the ESP8285

From what I understand, the CPU itself isn't changing one bit (80/160mhz 32-Bit RISC) but it's getting 1MB onboard flash. Considering the old Apple System 6 (including fonts, network, video, CD-ROM and even Zip Drive drivers) had an install anywhere between 232K and 372K, that's a lot of space to do many many things.

Sir Bobert Fishbone
Jan 16, 2006

Beebort

Hadlock posted:

The ESP8266 is getting a slightly bigger brother, the ESP8285

From what I understand, the CPU itself isn't changing one bit (80/160mhz 32-Bit RISC) but it's getting 1MB onboard flash. Considering the old Apple System 6 (including fonts, network, video, CD-ROM and even Zip Drive drivers) had an install anywhere between 232K and 372K, that's a lot of space to do many many things.

And technically isn't it a smaller brother, since it's being marketed specifically for "wearables"? Either way, it looks pretty dang cool.

Seat Safety Switch
May 27, 2008

MY RELIGION IS THE SMALL BLOCK V8 AND COMMANDMENTS ONE THROUGH TEN ARE NEVER LIFT.

Pillbug

Hadlock posted:

The ESP8266 is getting a slightly bigger brother, the ESP8285

From what I understand, the CPU itself isn't changing one bit (80/160mhz 32-Bit RISC) but it's getting 1MB onboard flash. Considering the old Apple System 6 (including fonts, network, video, CD-ROM and even Zip Drive drivers) had an install anywhere between 232K and 372K, that's a lot of space to do many many things.

It's a good size. The MicroPython ESP8266 kickstarter backer beta has said you need at least a 512KB device to get anything out of it, so I'm sure with some standard library trimming you still have a boatload of space.

I don't think System 6 had Zip drive support, though. It came out too late for that, unless the INITs worked or it was just a generic SCSI device to the Mac.

Seat Safety Switch fucked around with this message at 16:14 on Jun 23, 2016

wolrah
May 8, 2006
what?

Seat Safety Switch posted:

I don't think System 6 had Zip drive support, though. It came out too late for that, unless the INITs worked or it was just a generic SCSI device to the Mac.
http://lowendmac.com/2015/low-end-macs-compleat-guide-to-zip-drive-and-disks/ says Iomega drivers supported System 6 until version 5.0.

https://www.youtube.com/watch?v=BeEo0L-KPAY
In the video description the poster notes that inserting the disk in to a Mac running a newer version of the drivers results in it being silently "upgraded" to a version that won't work on System 6.

From a bit more looking around it seems like a Zip drive will appear as a generic SCSI storage device on pretty much anything, but supporting ejecting and re-inserting disks requires the driver. The official driver that works pre-Sys7 only supports Zip 100 but can be hex edited to support the Zip 250 as well since they function the same other than their IDs.

...and there's your useless old system trivia of the day.

ImplicitAssembler
Jan 24, 2013

scandoslav posted:

I'm stuck on killswitch relay selection. It's my understanding that the motors on the RC crawler I'm using as a chassis can draw ridiculous amps when stalled. My ESC is rated for 60 amps continuous, 360 amps peak. I have not been able to find relays (at least on the sparkfuns/polulus/etcs.) that can handle that sort of VDC current, and the ones on digikey that can are hundreds of dollars. I'm assuming the worst case scenario of a glitch/bug holding a stall long enough to fuse an inadequate relay before the ESC's automatic overheat protection kicks in.

Clearly there are ways to do this. The esc has a swtich, after all. How is my near-complete ignorance of electronics biting me in the rear end this time?

Put a switch on signal wire to the ESC.
Something like this would do it, if you want to do it remotely:
http://www.hobbyking.com/hobbyking/store/__46040__Turnigy_Receiver_Controlled_Switch.html

Seat Safety Switch
May 27, 2008

MY RELIGION IS THE SMALL BLOCK V8 AND COMMANDMENTS ONE THROUGH TEN ARE NEVER LIFT.

Pillbug

wolrah posted:

...and there's your useless old system trivia of the day.
Sweet, thanks. I only used Zip drives for a little bit on 7.5 before it "audibly upgraded" a set of disks to nonfunctional.

huhu
Feb 24, 2006
I want to be able to send text to an Arduino and have it write on a paper surface with a marker. My basic idea is to use two stepper motors to control x/y motion along with a system to mount the motors, markers etc. The part I'm completely lost on his how to create a way to send instructions to the Arduino. My original, bad idea, was to create a library that defines what each letter would look like (an O would be, move right 1, up 2, left 1, down 2). However I've seen much more complicated designs that can water color, print in cursive, etc. What should I be reading up on to get started?

mod sassinator
Dec 13, 2006
I came here to Kick Ass and Chew Bubblegum,
and I'm All out of Ass
The easiest way is to use the USB serial port of the Arduino to talk to the computer. Use the Serial.print, Serial.println, and Serial.read functions to write and read from the serial port in your Arduino sketch. You can start out by using the serial monitor to manually send and receive data to get it all working. You'll want a simple command language, like maybe "M10,0" or something similar to tell your Arduino to move 10 units in the x and 0 units in the y axis for example. Then from your computer look into using PySerial or other simple serial port libraries in your preferred language of choice. Have your computer run a script that sends whatever commands you want to the Arduino.

Normal Barbarian
Nov 24, 2006

ImplicitAssembler posted:

Put a switch on signal wire to the ESC.
Something like this would do it, if you want to do it remotely:
http://www.hobbyking.com/hobbyking/store/__46040__Turnigy_Receiver_Controlled_Switch.html

That's most likely what I'll end up doing, though I'm a little concerned about stray radio waves (nearby RC cars or drone pilots or w/e) coming through and turning it off. I doubt it would ever actually happen, but these are the sorts of things I worry about.

Mini project update; soldered up the RoboPi kit without breaking anything other than one of the redundant 5V breakout pins (that I totally wasn't going to use anyways). I also soldered the LEDs to the capacitor holes, but that was relatively easily fixed. :downs:

I also learned that it's easy to go overboard on the flux, and that removing dried flux is a pain in the rear end.

ImplicitAssembler
Jan 24, 2013

scandoslav posted:

That's most likely what I'll end up doing, though I'm a little concerned about stray radio waves (nearby RC cars or drone pilots or w/e) coming through and turning it off. I doubt it would ever actually happen, but these are the sorts of things I worry about.

Not an issue with modern FSHH technology.

Normal Barbarian
Nov 24, 2006

ImplicitAssembler posted:

Not an issue with modern FSHH technology.

Well, huh. I guess things have changed in the 15+ years since I fooled around with (low-end RTR) RC. Neat.

Sagebrush
Feb 26, 2012

ImplicitAssembler posted:

Not an issue with modern FSHH technology.

You're thinking of FHSS.

FSHH technology is what cheap chinese electronics are made from.

ImplicitAssembler
Jan 24, 2013

Sagebrush posted:

You're thinking of FHSS.

FSHH technology is what cheap chinese electronics are made from.

Well.....

babyeatingpsychopath
Oct 28, 2000
Forum Veteran


huhu posted:

I want to be able to send text to an Arduino and have it write on a paper surface with a marker. My basic idea is to use two stepper motors to control x/y motion along with a system to mount the motors, markers etc. The part I'm completely lost on his how to create a way to send instructions to the Arduino. My original, bad idea, was to create a library that defines what each letter would look like (an O would be, move right 1, up 2, left 1, down 2). However I've seen much more complicated designs that can water color, print in cursive, etc. What should I be reading up on to get started?

You're basically implementing a 3d printer/CNC router that renders its own gcode on the fly. This isn't all that hard if your character set is limited and fixed. Look at shapeoko/RAMPS for already-built-and-implemented arduino shields that understand gcode. From there, you can write a glorified wrapper that reads text and sends gcode strings to the base firmware to draw on paper.

babyeatingpsychopath fucked around with this message at 04:36 on Jun 26, 2016

huhu
Feb 24, 2006

babyeatingpsychopath posted:

You're basically implementing a 3d printer/CNC router that renders its own gcode on the fly. This isn't all that hard if your character set is limited and fixed. Look at shapeoko/RAMPS for already-built-and-implemented arduino shields that understand gcode. From there, you can write a glorified wrapper that reads text and sends gcode strings to the base firmware to draw on paper.

Ha what fun is there in doing it this way.

Started writing my own Python powered tool to convert an image to a bunch of dots. Can't do much more testing until I get the physical design completed but it's looking pretty cool so far. This is what a printed image could look like:

huhu
Feb 24, 2006
I'm trying to send a matrix of values to the arduino somehow. All the stuff I'm reading about Serial, and char available, and SerialEvent and whatnot sounds horribly complicated and really confusing. Any suggestions of potentially an easier way to do this?

babyeatingpsychopath
Oct 28, 2000
Forum Veteran


What are you trying to do?

Serial communication is really very very simple.

Program A sends a string of characters to the arduino, which reads them. If program A is well-behaved, then you can just read a specific number of characters with the arduino every time. If not, then you loop over a state variable (while (Serial.CharacterAvailable())) and consume characters until there are no more, then do something.

Treat it like reading a series of strings from the keyboard or wherever, if that helps you.

huhu
Feb 24, 2006
I'm just not going to bother I think.

First project I'm going to try in Raspberry Pi instead of Arduino.

Edit: For anyone intimidated by Raspberry Pi like I was, check out this video below. I enjoy writing code much more in Python so I'm going to move there instead.

https://www.youtube.com/watch?v=IP-szuon2Bk

huhu fucked around with this message at 20:52 on Jul 2, 2016

gogoeric
Jul 13, 2016

by zen death robot

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.

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).

Digikey is great supplier for components, but price is expensive. If you want to order components, you could try China supplier, the price is very cheap. We have many customer ask us to buy the parts from China local supplier. And there are some good supplier like Mouser, Element14 and so on for components, and SUNSTONE, PCBGOGO for PCB prototype.

(USER WAS BANNED FOR THIS POST)

huhu
Feb 24, 2006
Why is it bad to hook up multiple buttons to the same pull down resistor?

Found my answer. For those that are curious - if you use the same pull up resistor, pressing one button down will cause all of the buttons to see 5V.


In unrelated news, my frustrations with push buttons let me to creating what I think is a pretty cool board which I've advertised on Kickstarter. If you're interested check it out here: https://www.kickstarter.com/projects/267560573/button-board-taking-the-pain-out-of-prototyping-el

huhu fucked around with this message at 17:24 on Jul 20, 2016

edmund745
Jun 5, 2010

gogoeric posted:

(user banned for selling China stuff)
A note about buying certain electronic parts from China, if it has not already been mentioned...

On other forums I'd seen people say that "some China parts are fake", but they usually didn't give any specific examples other than the Sparkfun fake-Arduino CPU chip story. That was one incident that occurred quite some time ago, and it's one that wouldn't affect most hobbyists because they don't buy entire reels of SMD embedded processors costing hundreds of dollars.

I've bought a lot of Arduino-type stuff and electronics parts off of the China-direct sites, all of it has arrived and and almost all of it has been 100% good.... but there is ONE part that was not.

On the China-direct sites, you can buy these bags of resistor assortments. They are light-blue 1/4-watt resistors, and usually claimed to be "1% metal film resistors".
It's nice for a beginner because you get a lot of different values of resistors for a rather small amount of money.
They're usually not 1% tho.
They are usually carbon-composition or carbon-film resistors (a lower-quality type) that have been painted the base color usually used for metal-film resistors (metal-film is a higher-quality type).

https://www.google.com/search?q=fake+chinese+1%25+metal+film+resistors&ie=utf-8&oe=utf-8

There is no law saying what base color should be used for certain resistor types, but there is a common convention that most other manufacturers have followed for a long time.
This page talks about the USUAL base colors used for regular types of thru-hole resistors:
http://electronics.stackexchange.com/questions/52030/how-to-determine-type-of-through-hole-resistor

Don't take my word for it, browse the Google results yourself.
It's pretty difficult to find anybody who ordered "1% metal film resistors" from any of the China-direct sites, and who actually received 1% metal-film resistors.

I bought two packs from two different sellers on aliexpress, and both turned out to be fake. It's not just a few sellers or one China-market site tho, this appears to be an issue on all of them. It is a currently-ongoing thing, right now.

I kept mine and didn't complain because I found out some time after I bought them, and for all the time and hassle involved, I didn't consider it to be worth the money. I still got 600+ resistors for a bit more than a penny each.
And the resistors are still usable--they're just not 1% metal-films.
Most common hobbyist stuff does not require 1% resistors; I only chose them because when I searched for "resistor assortment" all the first results were that type.

I had a small amount of (light-blue) 1% metal-film resistors I'd bought at another time from Newark. I checked a couple of those, and those are legit. They cost quite a bit more each than the fake China ones did, but then,,,, there you go.

Adbot
ADBOT LOVES YOU

mobby_6kl
Aug 9, 2009

by Fluffdaddy
I have one of these mystery pack of resistors on the way right now, will let you know how they turn out. Mirroring your experience, I've never had any issues with cheap Chinese parts but I'm not holding my breath in this case. TBH it won't really matter, I already used some high quality ones in the voltage divider and the rest is just for LEDs and poo poo.

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