Heh, we'd better be careful Randy - might fall foul of that "no ads" rule .
Yeah, I've only ordered one (now two) boards from them. This one's just a bit too big once they account for the sprues. Although, I could ditch the AC input , and rearrange things and probably get two boards on a panel.
Though, I think they dropped the "if it panels in that 100mm square, it's still $2" thing - just checking with this board tacked on $6 (but still, 20 boards for $20 ...)
-Dan
Builder of Bowser steam! Railimages Site
Distributing the lighting was where I was gooing wioth me "Smart Structure Lighting" - a small 8 pin chip in each structure rather than a single larger one with lots of wires going everywhere to each structure. That would allow for random (or not so random) multi-light effects with lights in different rooms going ona nd off, and even the occasional flickery TV effect. No extra drivers, if 5 different circuits aren't enough, a little multiplexing can get more, but it's doubtful that any one structure would need more than 5 independent light circuits. Might even be a place to try those 3 cent jobbies, although the 3 cent price only gets you the surface mount version, the PDIP ones a few few cents more (oh the horror - still under 10 cents, for a micro that can drive multiple LEDs with nothing more than a power supply bypass cap and some current limiting resistors on the LEDs).
And the heavy current drive with some bigger MOSFETs is coming - I forgot about that one. I intend to use LED strip lighting for my layout - multiuple rows of white, plus a row of RGB, plus a row of blue, so I can do anything from sunrise to sunset and anywhere in betwene on either side. The RGB set I got to play around with came with a controller, but it's only good for one reel (3 meters) of LEDs, and it only has 8 steps of brightness for each color, so smooth transistions - not so much. I'm sure I can do better with my own design. Plus you can;t string too many strips togetherm the flexible strips themselves can;t handle sufficient current to allow an unlimited number of stips to daisy chain, so there will be multiple segments, but I want all of them to change at the same time, so I need multiple controllers that all tie together through some method.
Yes, I use JLCPCB for the boards. The shipping costs more than the boards. 10 boards for $2, for up to a certain size 2-sided board with standard soldermask and so forth (they can do more layers, and have other color soldermasks and can do all sorts of other stuff too, but that costs more). There are some good Youtube videos from some of the electronics channels that have actually toured their factory. I've actually taken to using their EasyEDA software to draw schematics and then make the board layouts, it's far easier to use than anything else I tried (i REALLY wanted to like KiCAD, but damn.. and all the other stuff is prohbitively expensive, like OrCAD or Altium. And Eagle being bought out and changing the license models made that too annoying.). Since EasyEDA gets their schematic elements and PCB footprints from every part they sell through their third arm, LCSC, they have a full array of elements, I've had no problem finding anything I needed so far. It's completely free - the only catch is that you can only have a couple of 'private' projects (it's all web-based, but the software installs locally, although there is a browser-based version) for free, so you have to make your projects 'public' where anyone else using EasyEDA can open up your designs (they can;t change them in your account). Frankly, this is of no consequence to me since I have always intended on sharing my schematics and board layouts for all this model railroad stuff. Since they of course conveniently build a BOM you can one-click trnasfer over to LCSC to order the parts, I will probably do just that for my boards, they are no more expensive than anyone for typical components.
Oh - and 10 boards for $2 - well, if your design can fit multiple boards in the maximum space allowed for the 10/$2, you can further panalize things and get however many fits in each full boards x 10 for $2 - there's a Youtube video with a quite small design example that reslts in you getting 270 boards for $2, 27 of the small boards per panel, times 10 panels for $2.
Plus with each order they send you one of the slickest pens I've ever seen. It's actually a hard paper tube, but the pen cartridge in it draws one of the smoothest and finest lines I've ever seen outside of some fancy $10+ thing. This is not your typical 10 for a dollar Bic pen.
Oh, and you don;t HAVE to use EasyEDA to get the boards, you can use and PCB design application and just upload the Gerbers. But with EasyEDA - there's actually a button in there that transfers you right to JLCPCB and creates the order for you.
Oh, and you CAN go larger, it just won't be $2 any more. It's not crazy espensive, either. And they will also supply solder paste stencils for SMD boards.
--Randy
Modeling the Reading Railroad in the 1950's
Visit my web site at www.readingeastpenn.com for construction updates, DCC Info, and more.
Nice . That's $7.50 including the uno, right? Just about the same as getting 10 of these spun up from the prototype place -- about $6.50 per, although I have a gazillion resistors and capacitors on hand, so I didn't order anything new there.Mine are a bit bigger than an Uno (1.9 x 3.7" -- about the size of the 'MEGA' boards, IIRC)
Only real downside I can see to those Darlington Arrays is that they're 1:1 on the pin-mapping, so you're pretty much required to use the ATMega series of chips because you need the pins.
This board could be scaled up to drive 96 LEDs with only adding the necessary registers, pin headers, and an upgrade from the attiny25 to an attiny45 (there's not enough room to run the 96 pins in the -25 ... although I suppose you could run them in 3 banks of 32 with the code as-is). And really, the only reason that 96 is the limit is that the board manufacturer will only do a 100mm square (3.9") board for their cheap-as-chips pricing .
even with only one LED being on 1/n of the time, an entire row (10 LEDs) has the potential to overcurrent one of the Arduino pins (max 40mA), so the MOSFET is there as protection from that happening (e.g. from me writing bad code).
NeO6874he MOSFETs will handle something silly like 20 amps, so a single row could potentially have several thousand LEDs
if you drive an LED 1/N the the time, what is the average current? what so you need to drive the LEDs at?
greg - Philadelphia & Reading / Reading
Sure, you can multiplex LEDs too, Have a prototype multiplex array of 50 LEDs being driven from 10 pins (could make it 8 pins if I hard-lock the register "enable" and "clear" pins to either ground or +5v). Could also extend that to 80 LEDs without changing the pinout to the microcontroller (5x16 array). The MOSFETs will handle something silly like 20 amps, so a single row could potentially have several thousand LEDs (although any one shift register is limited to 70mA). But that's taking things a little too far, I think .
Tons of ways to skin the cat .
while the atmega328 on the Arduino (and Nano) runs at 5V, there is a regulator that will accept up to 12VDC.
there are easier ways to drive many LEDs. They don't need to be driven constantly. You can connect the LEDs in a matrix.
for example 8 rows and 8 columns. in a loop, you drive low one of the rows while driving high the LEDs in that row that you want lit. 16 I/O pins can control 64 LEDs. If you drive an LED 1/8 the time, you can drive it with 8x the current (which may exceed the atmel chip I/O limits).
Don't disagree Greg, but I needed 32 LEDs in one place .
Smaller controllers are dead easy - I actually started testing the idea with just one register (so 8 LEDs).
As are larger, though one would have to work in "banks" of 16, due to the way avr controllers handle numbers. I guess you could work in banks of 8 as well, but that starts getting painful fast.
Don't forget that with the Arduino boards you usually have to add a 3.3 or 5 volt power source -- these little ones I knocked together will take pretty much anything HO-scalers (and smaller) run under the layout, starting at about 9 volts or so - AC or DC. Max would be 35 volts in.
Randy, you use jclpcb too, huh?
NeO6874They definitely have their place, but tend to cost kind of a lot, at least for "official" ones (and even the Chinese cheapo ones are $3+) . ... I was able to order 10x custom PCBs and all the necessary components for only about the cost of an Arduino uno (maybe two, plus shipping).
i can understand the desire to make things inexpensive but wouldn't it be better to have several random light generators that can be placed at various locations on a layout closer to the building being lit than one requiring lots of lenghy wiring serving a larger portion of the layout?
Arduino Nano can be had for a $3+. Does size matter? Even if price matters, isn't it worth it to have a few to minimize wiring?
where do you guys get custom PCBs fabricated?
Yeah forget surface mount, I'm building all my stuff with through hole. I have enough vision issues so as it is and tend to solder about 5 inches from my face to see what I'm doing. No way can I do surface mount. I'm doing my own servo turnout controllers complete with frog power relays and both locla and remote control - I need enough pins that I am using ATMega328's, same micro on the Uno and Nano. I'm also doing my own version of the cpNode 'Arduino' based CMRI node to interface my detectors and signals - also ATMega 328 chips. I was going to use something like the Tiny 85 for structure light controls - but really those have more flash and eeprom that would ever be needed, so the Tiny 25 might be a better option, depends on the price. Also I need far too many to hand wire them all, so I am having boards made. I did one board so far, I made a programmer that uses a Nano to program a bare ATMega 328. Got 9 boards left - I only needed 1, but you get 10 for $2.
All these other things - ATTiny25, ATTiny85, are all just different Atmel (now Microchip) microcontrollers. Internally they all program the same, the difference is in the number of pins, amount of memory, etc. Since most Atmel chips have a common language, people have made board files for the Arduino IDE for most of them. Thus the same code you write for an actual Arduino piece of hardware will run on these other chips - just keep in mind the pins. An 8 pin chip like the Tiny 25 or Tiny 85, once you take away 2 pins for power and ground, only has 6 IO pins, and one is also the reset. So really 5 easily usable - compared to 20 on the ATMega 328 used in the Uno and Nano. So you can't do a pinMode(12,OUTPUT) on a Tiny 85 - there is no pin 12. But you can do pinMode(0,OUTPUT). So really - it's just like a different Arduino board with fewer outputs. FOr something like a grade crossing - you need what, 2 outputs for the flashing LEDS, 1 to drive the servo to raise and lower the gates, and 1 for a control input. Easily handled by a cheap Tiny-series chip instead os using a full-blown Arduino.
Was just watching a video on a micro you cna get from China that, in 300 unit quantites, are less than THREE CENTS each. Granted, they are one-time programmable - you can;t program and erase them, if you program one with bad code, it's just so much junk. but it was 3 cents! They are in no way Arduino compatible, the company has it's own development environment that appears to have tons of online help - even if some of it is a bit Chinglish, they really do seem to be trying to make this usable. I cna see some possibilities, but really these are not something for the casual hobbyist.
I do have an Uno, a Mega, and a handful of Nanos (I think i got the Nanos on Amazon, 5 for $12 or something - came as flat boards plus a stick of header pins I had to break apart and solder on myself). I use these on breadboards for developing and testing my designs, but the final product will use just the chip - all you need to use the bare chip is a 16MHz resonator, a pair of 22pF caps, and a couple of bypass caps on the poower suppyl lines. The second micro on the Uno board, the USB port, the 5V and 3.3V regulators - don't need ANY of that stuff in the finished product.
So just think of the Tiny 25 as an Uno with fewer pins. And less space for complex programs. But how much do you need? My servo controller, which has 2 pushbuttons, 2 LEDs, 2 relays, a servo, and two external inputs per turnout (and drives 2 turnouts), plus ALSO stores the last positioon in the EEPROM, using a system that spreads the EEPROM acces out over most of the memory space to even out the number of writes per memory address, uses 12% of the memory of an Uno/Nano. And that's without any attempts to optimize it for size. Today I did consolidate a set of outputs that were used in 4 different places into a single function, but the size didn't really change.
Don't worry about it :).
It's simply a specific microcontroller chip.
"Arduino" boards are built around some of their bigger cousins ... and since they're "RTR", well you pay for all the extras.
Randy, the protoboards are like 2x4 in. Size could definitely drop with some of those practically microscopic SMD components, but I'm building this by hand
Randy probably exposed my ignorance, but since I don't know what a ATTiny25 is, I can't be sure. Randy is one of my forum friends and I have no shortage of electrical ignorance.
For you guys that understood the OP's diagram, you can probably do it cheaper than the rest of us. Some of us need to be spoon fed.
Henry
COB Potomac & Northern
Shenandoah Valley
Yeah, an Arduino is simply a different (bigger) microcontroller thats essentially been factory-soldered to a breakout with a few addons (think of it as the "ready to run" version --with the RTR markup).
They definitely have their place, but tend to cost kind of a lot, at least for "official" ones (and even the Chinese cheapo ones are $3+) . All told (including ripoff fedex shipping because i was just over the USPS parcel post 14 ounce weight limit), I was able to order 10x custom PCBs and all the necessary components for only about the cost of an Arduino uno (maybe two, plus shipping).
I probably should've just dealt with ugly perfboard ... but the whole "present" thing, made me want to go and have the circuitry look nice for SWMBO.
Who says he isn't?
ATTiny25's, ATTiny85's, and other small micros can be programmed with the same IDE and infrastructure as a big giant Arduino Uno or even bigger Mega. That circuit on a small PCB would be smaller than an Uno, too - depending on what sort of connectors were used for the terminals to connect the lights to.
Got to remember, Arduino isn't really the hardware, it's the programming environment which has nice simple functions like pinMode and digitalWrite so you don't have to set registers in the micro to control each IO port.
One of the things I made is actually a programmer add-on that I can plug in an ATTiny85 (possibly a 25 even) and program it just as easily as I program a full fledged Arduino board. Those little chips are very cheap, and have more than enough power to do something liek produce multiple random lights in a structure. Smart Model Structures, maybe? Wait - I'm going to copyright that name LOL Even with an Arduino Nano or Uno, you'd still need shift registers to get 32 outputs. Only a Mega has that many (and more) built in. And a Tiny25 plus 4 shift register chips is a FRACTION of the price of a Mega board - which also has dozens of features not needed for a simple random lighting circuit.
You know this can be done with Arduino. I don't know enough to qualify as even an Arduino newbie, but Jerry Leone has a video on MRVP where he programmed random lights and sequential lights, like old movie marquees had.
In arduino, the time to turn off or on can be adjusted pretty easily. Maybe that is also the case for your experiement as well.
I've been toying with a 32-LED controller for a little tchotchkey present for SWMBO, and it kinda struck me that some fellow MRR's might find some use out of it -- maybe for randomized house lights "at night" or similar situations where you don't necessarily want "all" the lights to turn on at once.
Circuit's pretty simple - an ATTiny25 microcontroller is driving 4x SN74HC595 shift registers, and everything is getting 5V power from the LM317 voltage regulator. The board itself can be powered from either 12-24 VAC or 9-24VDC (DC_in merely goes through a single protection diode before the regulator, vs. the bridge rectifier for AC).
Here's a quick video of a test setup just soldered to some perf-board. (Sorry about the shaky-cam -- I was too excited I got it working to go hunting for a real camera, so was just using my phone) -- http://www.djph.net/media/32LightTest.mp4
Schematic: http://www.djph.net/media/Schematic_LightingController_v1.0.pdf
I'll put together a full Bill of Materials (with links, etc.) later -- the test circuit is built from stuff on the bench, so don't have all the info handy.