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
peepsalot
Apr 24, 2007

        PEEP THIS...
           BITCH!

Harvey Baldman posted:

Is there an easier answer I'm missing?
You could have the motor turn a screw thread to extend the barrel.

Adbot
ADBOT LOVES YOU

Sagebrush
Feb 26, 2012

#1 that is fuckin awesome and ever since the movie came out it has been a dream of mine to build one of those someday and I hope you continue to post about it.

#2 There are a couple of ways that you might move something in a linear fashion. The rail-with-teeth-and-gears is called a rack and pinion, and that's a valid way to make it work pretty cheaply. However, an issue with it is that you need to be able to tell the motor how many times to spin if you want it to extend a certain distance -- or at least where to stop when extending and retracting the device. So the simplest reasonable system there is a DC motor with a bidirectional driver (H-bridge), and limit switches at both ends. The motor just runs in one direction until the sliding part hits the limit switch and then shuts off.

If you want to get a little fancier, you can use a stepper motor, which moves in actual "steps" -- 200 little clicks per rotation of the shaft or whatever. Maybe your gear ratio means that the slider moves 10mm per rotation, so to move it 100mm you send 2000 pulses to the stepper and it moves the slider exactly that far. That's how most 3D printers position their head, for instance. You still need a limit switch at one end so that the system knows where to start counting from.

The most robust method is a servomotor, which is a motor that has all the encoding electronics built in. You tell it where to go and it goes to that position and holds it. You can get linear servos (linear actuators) but they are expensive, as you've discovered. Hobby servomotors are much cheaper, used in RC cars and quadcopters and stuff, but they can only swing back and forth 180 degrees. But you might be able to design a sort of linkage that turns that 180-degree motion into a linear action, like a crankshaft.

Cheapest and electrically simplest method would be a hobby servo, if you can get the linkage to work correctly and you can find one with enough power to drive the mechanism.

e: the screw thread idea is also a good one, though slower than the other methods since you only move 1 thread forwards per revolution. You'll still need encoders or limit switches of some kind for position sensing.

Splode
Jun 18, 2013

put some clothes on you little freak
If you're an electronics, servo motors are your best bet. They're cheap and way easier than the other options. You can get servo motors that are "continous rotation" as well as the limited angle ones, but the continuous rotation motors are controlled with a speed rather than an angle, do you'd have to work out the timing.

As for mechanisms, you could use a rack and pinion or a crank, the best approach depends on the geometry you're working with, how far you need it to extend and how fast.

peepsalot
Apr 24, 2007

        PEEP THIS...
           BITCH!

You could also not bother with a motor at all and just have some kind of spring action.

And if you think a spring is too fast and want to limit the speed, well, a quick anecdote first:
I was fascinated as a kid about how some cassette players and/or discman had lids that opened slowly and smoothly, and wondered how they did that. So I took them apart and saw that it was spring powered (not too much surprise), and the way they smoothed it out and slowed it down was basically a rack attached to the lid (well, it was a partial arc of a gear since the opening was a rotational rather than linear motion) and pinion that was free to spin except that there was a bunch of thick grease between the two for damping. To this day I still think that is a neat low tech sorta hack.

Splode
Jun 18, 2013

put some clothes on you little freak
Does anyone have a nice way of making 0.1" pin connections more permanent? Obviously I can desolder the headers but that's a bit of a pain, and if there's a clever way of doing it I'm all ears.

Sagebrush
Feb 26, 2012

Given that this is the Arduino thread, I assume you mean the 0.1" female header blocks on a regular Arduino?

Buy some 0.1" male header strips (pennies on Amazon), solder the wires onto those in a block, plug those into the female headers, and add some hot glue along the edges to keep it all in place.

Splode
Jun 18, 2013

put some clothes on you little freak

Sagebrush posted:

Given that this is the Arduino thread, I assume you mean the 0.1" female header blocks on a regular Arduino?

Buy some 0.1" male header strips (pennies on Amazon), solder the wires onto those in a block, plug those into the female headers, and add some hot glue along the edges to keep it all in place.

The board I'm using (Node MCU) actually has male header blocks (which came pre-soldered, gee thanks), though that is a really good trick!
I guess I could buy female blocks and do the same thing in reverse.

Hot gluing jumper leads should work nicely

Splode fucked around with this message at 07:02 on Jul 7, 2017

The Claptain
May 11, 2014

Grimey Drawer
You can also solder wires to the pins, though soldering them to female header miggt be better , it will take up more space but gives you an option of easily getting that nodemcu out if needed.

Hadlock
Nov 9, 2004

How fast does it need to go? You can do a worm gear which works but unless you have very large threading, is glacially slow for more than a few inches.

Also yeah you can get a cheap $3 hobby toy motor and put a black stripes on the piston with an optical sensor as a cut off.

Harvey Baldman
Jan 11, 2011

ATTORNEY AT LAW
Justice is bald, like an eagle, or Lady Liberty's docket.

peepsalot posted:

You could also not bother with a motor at all and just have some kind of spring action.

And if you think a spring is too fast and want to limit the speed, well, a quick anecdote first:
I was fascinated as a kid about how some cassette players and/or discman had lids that opened slowly and smoothly, and wondered how they did that. So I took them apart and saw that it was spring powered (not too much surprise), and the way they smoothed it out and slowed it down was basically a rack attached to the lid (well, it was a partial arc of a gear since the opening was a rotational rather than linear motion) and pinion that was free to spin except that there was a bunch of thick grease between the two for damping. To this day I still think that is a neat low tech sorta hack.

This is a cool idea, but since I'm already building a lot of electronics in (and have a lot of space to work with inside the gun) doing something manual and spring-loaded feels like a cop-out.

Hadlock posted:

How fast does it need to go? You can do a worm gear which works but unless you have very large threading, is glacially slow for more than a few inches.

Also yeah you can get a cheap $3 hobby toy motor and put a black stripes on the piston with an optical sensor as a cut off.

I probably want things to move about 3-4" in a fairly brisk way. I'm leaning towards some kind of rack and pinion setup at the moment if only because I don't have any way of easily figuring out how to design a linkage that would move correctly. I can model stuff up, but I don't know Fusion360 or anything that can do the simulations to make sure it won't jam. Gear teeth is much more straightforward.

Skunkduster
Jul 15, 2005




Harvey Baldman posted:

I probably want things to move about 3-4" in a fairly brisk way. I'm leaning towards some kind of rack and pinion setup at the moment if only because I don't have any way of easily figuring out how to design a linkage that would move correctly. I can model stuff up, but I don't know Fusion360 or anything that can do the simulations to make sure it won't jam. Gear teeth is much more straightforward.

Just an idea, but maybe get a car door lock actuator from a junkyard or amazon and hook it to a bar (bottom) on a pivot then hook whatever you want to slide at the opposite (top) end of the bar.

Only registered members can see post attachments!

Harvey Baldman
Jan 11, 2011

ATTORNEY AT LAW
Justice is bald, like an eagle, or Lady Liberty's docket.

SkunkDuster posted:

Just an idea, but maybe get a car door lock actuator from a junkyard or amazon and hook it to a bar (bottom) on a pivot then hook whatever you want to slide at the opposite (top) end of the bar.



This idea will work for the top hatches, I think. I'll keep that in mind.

So, I'm stuffing arduino and other hardware into this ZF-1 gun, and I'm noticing there is a screen on the back of the scope.



No doubt on the movie prop this is just a backlit film, buuuutt.... I want to make it work. Thinking it might be good to have it show as a 'fire selector' to indicate which weapon on the gun is active.

I've never worked with displays on an arduino before. I want to get a 128x128 screen and have it show images like this. Anyone got recommendations for simple options? Looking at this 128x128 TFT from AdaFruit presently but I'm not sure how hard these are to use.

Splode
Jun 18, 2013

put some clothes on you little freak
I was going to recommend something from adafruit.

Screens are kind of hard to use, but code libraries are available and with a library, it's something that takes time and fiddling rather than skill. If you can put an "a" on the screen somewhere then it's only a matter of time before you can put whatever you like on the screen.

Harvey Baldman
Jan 11, 2011

ATTORNEY AT LAW
Justice is bald, like an eagle, or Lady Liberty's docket.

Splode posted:

I was going to recommend something from adafruit.

Screens are kind of hard to use, but code libraries are available and with a library, it's something that takes time and fiddling rather than skill. If you can put an "a" on the screen somewhere then it's only a matter of time before you can put whatever you like on the screen.

I'm assuming the libraries make something like calling a few bitmaps from an sd card on the back of the display at the right time trivial. Are TFTs bright enough to see in daylight conditions?

Data Graham
Dec 28, 2009

📈📊🍪😋



The 4DSystems screens are wonderful. Fully self programmable with their own IDE, and you can talk to them over serial from an arduino if you don't want it to just run an independent program.

Sagebrush
Feb 26, 2012

For the look of that little screen on the back, I'd just go with whichever AdaFruit TFT is the proper size, yeah. With a bog-standard Arduino you won't get a super high refresh rate but it'll work for showing little graphics and things.

As for sunlight-readability: maybe? Depends on a lot of factors. You won't be able to see it if the sun's behind you and it's glaring off the screen, but if it's just overhead daytime sun it should be fine because there's a little shield over the screen in the design.

What are you going to do for the little red button on the bottom of the gun?

Harvey Baldman
Jan 11, 2011

ATTORNEY AT LAW
Justice is bald, like an eagle, or Lady Liberty's docket.

Sagebrush posted:

For the look of that little screen on the back, I'd just go with whichever AdaFruit TFT is the proper size, yeah. With a bog-standard Arduino you won't get a super high refresh rate but it'll work for showing little graphics and things.

As for sunlight-readability: maybe? Depends on a lot of factors. You won't be able to see it if the sun's behind you and it's glaring off the screen, but if it's just overhead daytime sun it should be fine because there's a little shield over the screen in the design.

What are you going to do for the little red button on the bottom of the gun?

My overall plan includes a lot of LED lighting and a pair of speakers for sound, so if the button gets pushed, I'd probably play some winding-up audio and make a lot of the lights all over the gun blink as though it's charging up to detonate. Could probably make a separate bitmap or bitmap(s) for the display to count the detonation down.

I'm still looking for an illuminated button that fits the profile - something between 20 and 25mm round.



If I can't find one the right size and shape, I can always make one, I guess. Just fake the illumination and 3d print something that fits over a smaller, more available pushbutton. Probably a safe assumption the one on the screen-used prop was just a bulb, rather than an actual button.

There's an orange one on the other side, too, of a different design, just to make my life more complicated.

Harvey Baldman fucked around with this message at 19:07 on Jul 10, 2017

peepsalot
Apr 24, 2007

        PEEP THIS...
           BITCH!

Here's one that looks pretty close:
http://www.ebay.com/itm/24mm-Yellow-Illuminated-Momentary-Push-Button-SPDT-Micro-Switch-N3-/122209817644

Try some different combinations of some of these search terms to find similar products:
illuminated / lamp / light
momentary / push button / switch
orange / [other color]
20mm / 21mm / ... 25mm / round
arcade

e: and of course always sort by price+shipping ascending for that cheap chinese goodness

peepsalot fucked around with this message at 19:33 on Jul 10, 2017

Nevets
Sep 11, 2002

Be they sad or be they well,
I'll make their lives a hell
If you end up 3d printing a button you could use trans(parent/lucent) filament & include a cavity to fit a 5mm led. The plastic should diffuse the light nicely.

Harvey Baldman
Jan 11, 2011

ATTORNEY AT LAW
Justice is bald, like an eagle, or Lady Liberty's docket.

I'm cross-posting this, but I figure the people in this thread might have some experience with Adafruit stuff. The TFT I was looking at earlier is actually too big to fit where I want it.

They make a .96" OLED display:

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

Since I'm still a caveman when it comes to this stuff, this thing appeals to me, since it has the microSD onboard and seems to simplify the implementation of a screen pretty substantially.

I see the display has ribbon connectors on the bottom that tether it to the board. Does anyone know if it would it be possible to pull the actual display up off the board, leave the ribbon connected, and have it still work at a ninety degree angle? I have a spot only just large enough where I can mount the display component, but not big enough to fit the board directly.

To wit:



I know I could buy the display component and ribbon cable separately, but I have no idea how to hook things up to those and it seems more complex than I can handle right now.

Harvey Baldman fucked around with this message at 21:27 on Jul 13, 2017

Sagebrush
Feb 26, 2012

Yeah, as long as there's enough slack in the cable that it doesn't pull on the solder joints where it attaches to the pcb, it's fine to do that.

rawrr
Jul 28, 2007
Usually it's just held against the PCB with double sided tape. Only thing is you gotta be careful when prying it free; I partially ruined an OLED by pulling against it too hard.

Skunkduster
Jul 15, 2005




rawrr posted:

Usually it's just held against the PCB with double sided tape. Only thing is you gotta be careful when prying it free; I partially ruined an OLED by pulling against it too hard.

If that's the case, heating it up with a blow dryer would probably help soften the glue on the tape.

Harvey Baldman
Jan 11, 2011

ATTORNEY AT LAW
Justice is bald, like an eagle, or Lady Liberty's docket.

Thank you for the advice on that. Hair dryer plus scalpel was just enough to make it come off, and it continues to work just fine!

Parts Kit
Jun 9, 2006

durr
i have a hole in my head
durr
Was looking at some Python stuff and ran across this, holy poo poo look at all that delicious I/O. And 168mhz, 1 meg flash, 192kb ram , 6 UARTs, and 12 bit ADCs. Yes please.
https://store.micropython.org/store/#/products/PYBv1_1

Harvey Baldman posted:

Thank you for the advice on that. Hair dryer plus scalpel was just enough to make it come off, and it continues to work just fine!


Love it.

huhu
Feb 24, 2006

Parts Kit posted:

Was looking at some Python stuff and ran across this, holy poo poo look at all that delicious I/O. And 168mhz, 1 meg flash, 192kb ram , 6 UARTs, and 12 bit ADCs. Yes please.
https://store.micropython.org/store/#/products/PYBv1_1

Love it.

Is this the middle ground between the Arduino and raspberry pi I'm hoping for? I'd love to be able to program in Python but the RaspPi is a bit overkill.

ynohtna
Feb 16, 2007

backwoods compatible
Illegal Hen
PyBoards are a pleasure to hack on.

Acid Reflux
Oct 18, 2004

Anyone have any favorite neopixel tutorials? I got a bunch of the little individual ones on round PCBs to play with, but everything I've come across so far seems to want to teach me how to use whole strips. My programming skill level without just cribbing code is roughly "hello world", so the more toddler-oriented the material is, the better.

Spazzle
Jul 5, 2003

Acid Reflux posted:

Anyone have any favorite neopixel tutorials? I got a bunch of the little individual ones on round PCBs to play with, but everything I've come across so far seems to want to teach me how to use whole strips. My programming skill level without just cribbing code is roughly "hello world", so the more toddler-oriented the material is, the better.

The strips are just individual ones linked together. I think you can actually cut singles off and use them.

If you really only want one pixel you could set the strip length to one.

I also prefer the fast led library. If I recall the default neopixel library was laughably slow.

Acid Reflux
Oct 18, 2004

That fast led library looks like just the ticket. Their basic usage tutorial is easy to understand even for someone like me. I guess I sort of knew that the number of individual LEDs didn't matter all that much, but I'm fearful of new things. Thank you!

babyeatingpsychopath
Oct 28, 2000
Forum Veteran


Spazzle posted:

The strips are just individual ones linked together. I think you can actually cut singles off and use them.

If you really only want one pixel you could set the strip length to one.

I also prefer the fast led library. If I recall the default neopixel library was laughably slow.

I was using the fast LED library for strips, but now I've got some panels. Is there an equivalent to fastLED for neoMatrix?

Spazzle
Jul 5, 2003

babyeatingpsychopath posted:

I was using the fast LED library for strips, but now I've got some panels. Is there an equivalent to fastLED for neoMatrix?

I haven't used NeoMatrixes before. Looking at the adafruit page brieflly (https://learn.adafruit.com/adafruit-neopixel-uberguide/neopixel-matrices) it implies to me that it behaves like a strip that happens to be arranged in a 2d pattern. That is, if you had a 16x16 array of 256 pixels, it could be addressed as a 256 pixel strip, where it just goes to a new line every 16 pixels, or some such depending on the toplology. If that is the case, the fast led code would probably be equally applicable. Just figure out how pixel number maps to array position.

Coincidentally, I did just order a bunch of these (https://www.adafruit.com/product/2277) to drive off a raspi. I'll see how much of a boondoggle they are.

Fanged Lawn Wormy
Jan 4, 2008

SQUEAK! SQUEAK! SQUEAK!
I have used fastled with the adafruit matrices - they work just like 8 strips of 8 pixels daisy chained like reading text, left to right, top to bottom.

Also, if you end up doing multiple pixel strings, follow the neopixel guide advice if putting a resistor in series on the data pin. Something about writing multiple pixel strings on multiple pins can cause the first pixel in line to fail. I've found a 470 ohm resistor fixes that right up.

TheresaJayne
Jul 1, 2011
I am looking for the smallest profile possible,

what is the smallest you can do - i thought once i did see a chip with internal clock so you dont need anything except power and the pins you are using but i can't find that detail anymore

So what is the smallest arduino package you can functionally use?

Fanged Lawn Wormy
Jan 4, 2008

SQUEAK! SQUEAK! SQUEAK!
The adafruit trinket is the smallest arduino compatible I've dealt with : https://www.adafruit.com/product/1501

They just came out with a 32bit version too :eyepop:

Aurium
Oct 10, 2010
If you're ok with an external programmer (a regular Arduino can do this), you can get it down to a single attiny85 chip and nothing else.

https://create.arduino.cc/projecthub/arjun/programming-attiny85-with-arduino-uno-afb829

Advantages:
Still small while being an easy to solder to.
Outright tiny if you use one of the smd variants.

Disavantages:
Only 3 useable pins.
Kind of picky about power. (Not too bad, 3-5 volts)

Sagebrush
Feb 26, 2012

Aurium posted:

If you're ok with an external programmer (a regular Arduino can do this), you can get it down to a single attiny85 chip and nothing else.

https://create.arduino.cc/projecthub/arjun/programming-attiny85-with-arduino-uno-afb829

Advantages:
Still small while being an easy to solder to.
Outright tiny if you use one of the smd variants.

Disavantages:
Only 3 useable pins.
Kind of picky about power. (Not too bad, 3-5 volts)

Note that the internal oscillator on these chips could be generously described as "close enough." You can absolutely run the microcontroller with nothing external beyond a power supply, but if you're doing anything that needs to be accurately timed to less than +/- 10%, you still want that external clock. I haven't had too many problems with the chip alone, but I've seen UART transmissions get corrupted, and two identical devices both running on their own oscillator will quickly get out of sync.

babyeatingpsychopath
Oct 28, 2000
Forum Veteran


Fanged Lawn Wormy posted:

I have used fastled with the adafruit matrices - they work just like 8 strips of 8 pixels daisy chained like reading text, left to right, top to bottom.

Also, if you end up doing multiple pixel strings, follow the neopixel guide advice if putting a resistor in series on the data pin. Something about writing multiple pixel strings on multiple pins can cause the first pixel in line to fail. I've found a 470 ohm resistor fixes that right up.

Yeah, I've got a bunch of individual strips, and they're wired differently than the tiles.

I'm using the adafruitGFX library to draw lines and pictures and whatnot. It's nice that the neoMatrix library can just take my arbitrarily-wired strings and make them work right. I'd really prefer to not rewrite a graphics library in assembly for yet another platform.

edmund745
Jun 5, 2010

TheresaJayne posted:

I am looking for the smallest profile possible, ... So what is the smallest arduino package you can functionally use?
You can run a SMD chip like that, if you want. There is a lot of "tiny arduino boards" that are basically just a processor on a board with a few components to make it more convenient, but lacking the major Uno features like power regulation and USB plugs.

The smallest 'easy-to-use' board I've found is the Digispark.
http://digistump.com/products/1
One version has a micro-USB socket, and the other version just has flat contacts printed on the PCB. The two versions work the same tho.
China clones cost about $1. There is a Arduino IDE plugin for them, so in theory, you would just plug them in and they would work as easily as any other Arduino board...

Note: Digisparks use an odd bootloader that causes issues in Windows. I could not get them working on my Windows 10 machine.
The bootloader only acts like a USB device for five seconds, and then boots into the onboard program.
With many Windows PCs, 5 seconds isn't enough to ID the USB device, so they can't ID it and connect to it.
there is pages about this issue out there. One example:
https://digistump.com/board/index.php?topic=248.0
This is just the way they are, and no fix seems to be coming. They were developed on Linux and apparently don't have any problems on a Linux or an Apple PC.

The Arduino Nano is pretty small (.75 x 1.75 inches) it's easy to use (it's the same thing as an Uno) and China clones only cost like $2. It has a USB plug on it so you just plug it into the PC. It's 5v logic only.

The Pro Mini is about as small but a different shape. It's got no USB interface so you need a USB-to-serial converter to program it, that costs $2-$3 from China-land. And the clones aren't any cheaper than the Nano. It's main advantage is that there is 3.3 and 5v versions, so if you needed 3.3v you can get that.

Adafruit stuff isn't cheap, but usually works well and has good documentation.
Sparkfun-made stuff is good too.

Adbot
ADBOT LOVES YOU

Parts Kit
Jun 9, 2006

durr
i have a hole in my head
durr

Spazzle posted:

I also prefer the fast led library. If I recall the default neopixel library was laughably slow.
It may just be me or the combo of stuff I was using on a past project but Adafruit's libraries seem really bloated.

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