Author Topic: Conway's game of life Pixel (First Project)  (Read 8368 times)

0 Members and 1 Guest are viewing this topic.

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 12852
Re: Conway's game of life Pixel (First Project)
« Reply #25 on: February 04, 2017, 03:29:20 pm »
An entry level Arduino is really just a development board for the 20 pin ATmega328P 8bit MCU, + an on-board USB <=> serial chip for PC communications + a toolchain and U/I that's aimed at users with no prior experience of embedded development.  If the 'Arduinoness' offends you, you can ignore the Arduino libraries and simply code in 'raw' GCC C for an ATmega target, or you can throw out the whole software toolchain and use Atmel Studio.  For your application a ten pack of Nano boards would just be a cheap way of getting enough boards to do a small 3x3 segment of your final concept, all with PC interfaces so the perimeter boards could exchange data with a PC emulating the rest of a larger matrix.

Any of Microchip's debug capable newer 8 bit PICs could also do the job, but that will cost you a lot more if you don't already have a PICkit 3 or ICD 3 and some USB <=> logic level serial interfaces to handle the PC comms.

An 8051 would  be fairly crazy unless you've already got the development tools and know how to use them.  Some of its successors with compatible cores in lower pin count packages would probably be suitable, but if you've used 8051s seriouly you should already know that and we wouldn't be having this debate.

There is little point in building hardware cellular automatia unless you have a strong interest in the details. IMHO it starts to become less meaningful as soon as you put more than one cell in a single MCU.  If its just the aesthetic result you are interested in, a large LED matrix controlled by a single reasonably fast SBC running a cellular automatia smulator will be cheaper and far easier to get working.
 

Offline skliffmuellerTopic starter

  • Newbie
  • Posts: 8
  • Country: us
Re: Conway's game of life Pixel (First Project)
« Reply #26 on: February 04, 2017, 03:40:12 pm »
I am completely interested in the full development process. I'm just getting bored of the adruino build, and implementation of proof of concept. I understand the idea, but if I'm only going to learn a single framework, and not the inner workings of electronics, I kind of feel like what's the point? I'm not learning anything, and if I'm looking to getting price points down, why would I spend $2 on an arduino chip, if I can get a 40 cent chip that does the job. When it comes to assembly language? I'm not afraid of it. I've written for z80, 68k, and some really basic x86. C? proficient at it. Scripting languages, mostly what I do. USB interfaces for programming devices? They don't seem that expensive. Development tools, how much help do I really need when I have a datasheet? I'm not afraid of the investment part of the learning experience.

As I stated on the original post, I am looking to learn the process of making a production ready device. Proof of concept, you can goto youtube and find someone making conways game of life with an arduino. :P
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 12852
Re: Conway's game of life Pixel (First Project)
« Reply #27 on: February 04, 2017, 03:53:55 pm »
The devil is in the details of the inter-processor communications needed for each cell to see the state of its neighbours.  As you have pointed out, there are plenty of Arduinos running cellular automatia simulators, but I believe you'll find that scalable expandable multiprocessor ones are vanishingly rare.   You cant design for production without a firm specification, and that's what the prototyping gets you - at the moment you don't even have a firm idea what you need for minimum connectivity per side without compromising functionality.  *EVERY* additional plated sprung contact costs money . . .
Then there's the cost of the MCU, a $0.40 chip is only cheaper if it can do the job.  If you run out of pins, memory or MIPS, you will deeply regret locking in to a 'cheap' MCU.
« Last Edit: February 04, 2017, 03:59:01 pm by Ian.M »
 

Offline skliffmuellerTopic starter

  • Newbie
  • Posts: 8
  • Country: us
Re: Conway's game of life Pixel (First Project)
« Reply #28 on: February 04, 2017, 04:07:32 pm »
Which is why I'm asking for suggestions on what are practical applications of multi node serial busses, but I don't want to sound like I'm not coming up with ideas so I throw I2C out there, but then I'm told it's not going to work without any further suggestion of an alternate solution or ideas, so I'm back to square one to throwing ideas on the wall with no real practical knowledge of the options available, and their pro's and cons of usage. Once I can get an idea of what is required for communication, I can come up with the pin configuration, select an MCU appropriate to I/O availability, real-estate, and cost. I can come up with some small list of options. Then when I do prototype, I can dig up some arduinos out of a box and prototype within those known constrains to see practicality of my selected device implementations, and if things look promising, buy up some MCU's from the selected list and develop again. Once price point is within reason, scale, and prototype some more.

So for now, lets just say I will select whatever MCU. The current problem. Communication. What are some options that would allow multi node serial communication for 1,000+ nodes, with minimal impact to number of communication pins.
 

Offline MattHollands

  • Frequent Contributor
  • **
  • Posts: 313
  • Country: gb
    • Matt's Projects
Re: Conway's game of life Pixel (First Project)
« Reply #29 on: February 04, 2017, 04:26:10 pm »
I know that you've changed from an analog implementation to a micro controller - but I have been having a bit of a play and I've found a way to get your design into two very cheap chips. My design basically uses a latch, 4 comparators and a bunch of resistors. A quad comparator costs less than 30c on digikey and similarly does a latch.

The circuit basically uses a resistor ladder to produce a voltage n/8 volts where n is the number of neighbours that are alive (ie a logic high). Then, 3 comparators are used to generate three logic bits:

A = 3 or more neighbours alive
B = 2 or more neighbours alive
C = 3 or less neighbours alive

The final bit is the current state: S = 1 if alive or 0 if dead.

These four logic bits are then combined via another resistor network to create a voltage that is above 2Vcc/3 if the new state should be alive and less than 2Vcc/3 if the new state should be dead. A final comparator is used to turn this into a logic bit.

Stick a latch on the output of this and clock it with your AC and you're done. Pictures attached.

You can basically see that, if the current state is dead, then the pixel will only become alive if there are exactly 3 neighbours alive. If the current state is alive then the pixel will only stay alive if there are 2 or 3 neighbours alive.

[Edit] I haven't looked at exactly how accurate the resistor values need to be. Probably best to do some kind of Monte Carlo simulation if you want to make sure this will work with 5%+ error in values. But my intuition at the moment is that it wouldn't be overly sensitive to this. [/Edit]
[Edit] Also would have to make sure the input impedance of your comparators was not significant, but that just comes down to component selection, and you can always scale the resistor values down by an order of magnitude if you like [/Edit]
« Last Edit: February 04, 2017, 04:36:53 pm by MattHollands »
Read about my stuff at: projects.matthollands.com
 

Offline kwass

  • Frequent Contributor
  • **
  • Posts: 347
  • Country: us
Re: Conway's game of life Pixel (First Project)
« Reply #30 on: February 04, 2017, 04:38:38 pm »
I thought about this problem years ago and decided that I would use short range IR optical coupling between elements, with cut corners for the diagonal ones.  The clocking would be done from overhead, also IR optical.  Each cell would have it's own battery power and, of course, visible light LED state indicator and a button to initialize it's state.

I never constructed this as the expense and tedium of building enough cells for interesting patterns would be no fun.
-katie
 

Offline skliffmuellerTopic starter

  • Newbie
  • Posts: 8
  • Country: us
Re: Conway's game of life Pixel (First Project)
« Reply #31 on: February 04, 2017, 04:45:20 pm »
I know that you've changed from an analog implementation to a micro controller - but I have been having a bit of a play and I've found a way to get your design into two very cheap chips. My design basically uses a latch, 4 comparators and a bunch of resistors. A quad comparator costs less than 30c on digikey and similarly does a latch.

The circuit basically uses a resistor ladder to produce a voltage n/8 volts where n is the number of neighbours that are alive (ie a logic high). Then, 3 comparators are used to generate three logic bits:

A = 3 or more neighbours alive
B = 2 or more neighbours alive
C = 3 or less neighbours alive

The final bit is the current state: S = 1 if alive or 0 if dead.

These four logic bits are then combined via another resistor network to create a voltage that is above 2Vcc/3 if the new state should be alive and less than 2Vcc/3 if the new state should be dead. A final comparator is used to turn this into a logic bit.

Stick a latch on the output of this and clock it with your AC and you're done. Pictures attached.

You can basically see that, if the current state is dead, then the pixel will only become alive if there are exactly 3 neighbours alive. If the current state is alive then the pixel will only stay alive if there are 2 or 3 neighbours alive.

[Edit] I haven't looked at exactly how accurate the resistor values need to be. Probably best to do some kind of Monte Carlo simulation if you want to make sure this will work with 5%+ error in values. But my intuition at the moment is that it wouldn't be overly sensitive to this. [/Edit]
[Edit] Also would have to make sure the input impedance of your comparators was not significant, but that just comes down to component selection, and you can always scale the resistor values down by an order of magnitude if you like [/Edit]

Really neat idea, One thought though, don't you only need 4 steps of voltage, everything after could be just Vmax resulting in death?

I thought about this problem years ago and decided that I would use short range IR optical coupling between elements, with cut corners for the diagonal ones.  The clocking would be done from overhead, also IR optical.  Each cell would have it's own battery power and, of course, visible light LED state indicator and a button to initialize it's state.

I never constructed this as the expense and tedium of building enough cells for interesting patterns would be no fun.


I'm beginning to notice this.
 

Offline MattHollands

  • Frequent Contributor
  • **
  • Posts: 313
  • Country: gb
    • Matt's Projects
Re: Conway's game of life Pixel (First Project)
« Reply #32 on: February 04, 2017, 04:47:15 pm »
I know that you've changed from an analog implementation to a micro controller - but I have been having a bit of a play and I've found a way to get your design into two very cheap chips. My design basically uses a latch, 4 comparators and a bunch of resistors. A quad comparator costs less than 30c on digikey and similarly does a latch.

The circuit basically uses a resistor ladder to produce a voltage n/8 volts where n is the number of neighbours that are alive (ie a logic high). Then, 3 comparators are used to generate three logic bits:

A = 3 or more neighbours alive
B = 2 or more neighbours alive
C = 3 or less neighbours alive

The final bit is the current state: S = 1 if alive or 0 if dead.

These four logic bits are then combined via another resistor network to create a voltage that is above 2Vcc/3 if the new state should be alive and less than 2Vcc/3 if the new state should be dead. A final comparator is used to turn this into a logic bit.

Stick a latch on the output of this and clock it with your AC and you're done. Pictures attached.

You can basically see that, if the current state is dead, then the pixel will only become alive if there are exactly 3 neighbours alive. If the current state is alive then the pixel will only stay alive if there are 2 or 3 neighbours alive.

[Edit] I haven't looked at exactly how accurate the resistor values need to be. Probably best to do some kind of Monte Carlo simulation if you want to make sure this will work with 5%+ error in values. But my intuition at the moment is that it wouldn't be overly sensitive to this. [/Edit]
[Edit] Also would have to make sure the input impedance of your comparators was not significant, but that just comes down to component selection, and you can always scale the resistor values down by an order of magnitude if you like [/Edit]

Really neat idea, One thought though, don't you only need 4 steps of voltage, everything after could be just Vmax resulting in death?


Well that is true but I don't see any advantage in finding some way to make the steps non-linear.

[Edit] Another reason I like my design is that it is basically a neural network in physical implementation. Each comparator is a neuron which sums it's input with weights and then outputs something. [/Edit]
« Last Edit: February 04, 2017, 06:08:39 pm by MattHollands »
Read about my stuff at: projects.matthollands.com
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 21658
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Conway's game of life Pixel (First Project)
« Reply #33 on: February 04, 2017, 05:11:36 pm »
Note that the above merely solves the state transition -- but additional hardware is necessary to sequence the states.

To do that, you could use a dual analog switch, so that the current state is passed to a capacitor, and then the capacitor state is brought to the outside world (via logic buffer).  The switches alternate (with dead time to prevent the "new" state bit from surging straight ahead), thus acting as a master-slave type D flip-flop.

Or, of course, you can simply use a flip-flop. ;D  (This is, more or less, what a CMOS D-f/f does internally -- bidirectional switches are used to shuttle the internal state forward.  Set and reset gates are added, obviously, to realize the full function, but those aren't needed here.)

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline MattHollands

  • Frequent Contributor
  • **
  • Posts: 313
  • Country: gb
    • Matt's Projects
Conway's game of life Pixel (First Project)
« Reply #34 on: February 04, 2017, 05:35:01 pm »
Note that the above merely solves the state transition -- but additional hardware is necessary to sequence the states.

To do that, you could use a dual analog switch, so that the current state is passed to a capacitor, and then the capacitor state is brought to the outside world (via logic buffer).  The switches alternate (with dead time to prevent the "new" state bit from surging straight ahead), thus acting as a master-slave type D flip-flop.

Or, of course, you can simply use a flip-flop. ;D  (This is, more or less, what a CMOS D-f/f does internally -- bidirectional switches are used to shuttle the internal state forward.  Set and reset gates are added, obviously, to realize the full function, but those aren't needed here.)

Tim

Well I did say in my explanation that you need a latch. So yeah put a d type latch on the output... Obviously have to make sure setup and hold times are satisfied but again that's just component choice
Read about my stuff at: projects.matthollands.com
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 12852
Re: Conway's game of life Pixel (First Project)
« Reply #35 on: February 04, 2017, 08:08:29 pm »
Back to the digital MCU implementation:
Which is why I'm asking for suggestions on what are practical applications of multi node serial busses, but I don't want to sound like I'm not coming up with ideas so I throw I2C out there, but then I'm told it's not going to work without any further suggestion of an alternate solution or ideas, so I'm back to square one to throwing ideas on the wall with no real practical knowledge of the options available, and their pro's and cons of usage. Once I can get an idea of what is required for communication, I can come up with the pin configuration, select an MCU appropriate to I/O availability, real-estate, and cost.
<snip>
So for now, lets just say I will select whatever MCU. The current problem. Communication. What are some options that would allow multi node serial communication for 1,000+ nodes, with minimal impact to number of communication pins.
Although you may have thousands of nodes (if you win the lottery 8) ), why do you think they should all be on the same bus and why do you think that bus needs to be switchable?

The basic requirements are: to communicate bidirectionally with all neighbours to exchange local state maps, to distribute a clock or other sequencing signal,  to discover the local mesh topology, and to forward commands, either selectively along a particular route via a particular side, or broadcast out of all sides except the one it came in on.

Obviously, there's got to be something to stop commands being passed node to node in an infinite loop, and the easiest solution to that is a command sequence number, which gets stored in a buffer so duplicates of recent commands can be ignored.

You want to eventually implement this to commercial design standards, so all off-cell I/O is going to need ESD protection, + good interconnects are not cheap, so there is a strong incentive to minimise the number of interconnects per side.  If you can use a single pin bidirectional bit-banged serial link per side it will be a lot cheaper than a design that needs a UART or other hardware serial comms peripheral per side or needs some sort of switching matrix.  Additionally, by implementing the state clock as a broadcast command, you save a pin per side.

I think it can be got down to four I/O pins for comms and three contacts per side in a vertical row - ground at the bottom, power in the middle and data at the top.
 

Offline oPossum

  • Super Contributor
  • ***
  • Posts: 1415
  • Country: us
  • Very dangerous - may attack at any time
Re: Conway's game of life Pixel (First Project)
« Reply #36 on: February 04, 2017, 09:14:40 pm »
This has already been done with a microcontroller....

https://www.adafruit.com/products/89


 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 12852
Re: Conway's game of life Pixel (First Project)
« Reply #37 on: February 05, 2017, 12:08:57 am »
I'm not surprised its been done as a tileable 8 bit MCU implementation, as cellular automata have been popular with computer hobbyists almost as long as there have been computer hobbyists,

The challenge would be to do it better* or cheaper, and its certain the O.P would learn a lot from the development process from first principles to something that would be ready to put on Kickstarter.

Perhaps the analog version deserves further study - e.g. what would be the minimum component set to implement a 2x2 tile, and would it be significantly less than those needed for four single cells?

* the Adafruit version is really quite limited - if you want to change the algorithm you would have to flash it with new firmware, and there is no way of interacting with or controlling it other than to reset the tile.
« Last Edit: February 05, 2017, 12:12:19 am by Ian.M »
 

Offline Brumby

  • Supporter
  • ****
  • Posts: 12297
  • Country: au
Re: Conway's game of life Pixel (First Project)
« Reply #38 on: February 05, 2017, 01:47:44 am »
The question of processing states is, indeed, a primary concern - but with any analogue or other non-MCU implementation, what about setting the initial states?
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 21658
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Conway's game of life Pixel (First Project)
« Reply #39 on: February 05, 2017, 02:21:34 am »
A button to toggle each bit would be cool. :)

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline djacobow

  • Super Contributor
  • ***
  • Posts: 1151
  • Country: us
  • takin' it apart since the 70's
Re: Conway's game of life Pixel (First Project)
« Reply #40 on: February 05, 2017, 03:08:58 am »
I did this several years ago on a 16x16 led matrix driven by an atmega328 ana shift registers.

It's really a clock, but it has Conway mode ... Because.

Happy to send the code to whoever is interested.

By the way, it runs much faster than in this video. I just slowed it down so it's more fun to watch.


 

Offline Sigmoid

  • Frequent Contributor
  • **
  • Posts: 488
  • Country: us
Re: Conway's game of life Pixel (First Project)
« Reply #41 on: February 05, 2017, 12:08:00 pm »
Well if you have an interconnected 2 dimensional array of programmable nodes, you might want to look into Cellular Neural Networks, as that's what you really have on your hands... ;)

https://en.wikipedia.org/wiki/Cellular_neural_network
 

Offline FrankBuss

  • Supporter
  • ****
  • Posts: 2365
  • Country: de
    • Frank Buss
Re: Conway's game of life Pixel (First Project)
« Reply #42 on: February 05, 2017, 01:43:21 pm »
Any of Microchip's debug capable newer 8 bit PICs could also do the job, but that will cost you a lot more if you don't already have a PICkit 3 or ICD 3 and some USB <=> logic level serial interfaces to handle the PC comms.

The original PicKit3 costs EUR 46: http://www.digikey.de/product-detail/de/microchip-technology/PG164130/PG164130-ND/2171224 And probably the $15 clones from eBay are fine, too. So such a programmer and a bunch of low-cost PICs are much cheaper than a bunch of Arduinos.

In this video, Mike explains an interesting project with lots of LEDs, and how they are controlled and connected:



Besides the communication, which is controlled from a central controller in this case, the power distribution is critical. If you are going to connect lots of these dots, the connectors won't handle the high current, so you might need high voltage and locale voltage regulators for each pixel, or some structural base with big power supply rails.
So Long, and Thanks for All the Fish
Electronics, hiking, retro-computing, electronic music etc.: https://www.youtube.com/c/FrankBussProgrammer
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 12852
Re: Conway's game of life Pixel (First Project)
« Reply #43 on: February 05, 2017, 07:08:37 pm »
A ten pack of CH340 Arduino Nano clones can be found on Ebay for as little as $21.50
e.g. http://www.ebay.com/itm/10PCS-Arduino-Nano-V3-0-ATmega168-16M-5V-Micro-controller-CH340G-MINI-USB/182314708074

By the time you've got a PICkit 3 clone, enough PICs and some matrix board, it will almost certainly have gone over that price, and if you run into any problems you wont know whether to blame Microchip, your PIC supplier or your PICkit 3 clone supplier.

I'd go with PICs, but I already have the toolchain and over 15 years experience with them . . .

For someone less comfortable with modern single chip 8 bit MCUs the pack of Arduinos is likely to be a better entry point, and faster + cheaper to get running - stick them down on a boad with double sided foam tape and wire the test matrix point to point.

I agree power distribution is going to be an issue once one tries to reduce the concept to plug&play blocks - pushing more than 1A through sprung side contacts is asking for trouble.  Smaller matrices can be fed from the edges - if you run power and ground bus bars all the way along the longest edges, depending on your unit module current, as many as 25 modules daisychained may be practical, allowing a matrix of 50 across.  Larger matrices would have to be back-fed, one feed module in the middle of each 5x5 block, with a local regulator for it under the baseboard.

Of course if you want 5W pixels visible outdoors in direct sunlight, that's a whole different ballgame
« Last Edit: February 05, 2017, 07:39:51 pm by Ian.M »
 

Offline FrankBuss

  • Supporter
  • ****
  • Posts: 2365
  • Country: de
    • Frank Buss
Re: Conway's game of life Pixel (First Project)
« Reply #44 on: February 05, 2017, 07:35:17 pm »
Nice, the CH340 Arduinos are really cheap, thanks for the link (on German eBay: http://cgi.ebay.de/272308424805 ), I might buy a pack. How can they do this for this price? Just the ATMEGA168 costs $1.50 (if you buy 2,000) and the CH340G with crystal etc. might cost another dollar, and then the cost of the board, connector, jellybean parts etc. has to be added.

You are right, you can't build it cheaper, unless you build a lot of it. A custom board, soldering it and even a cheap PIC would cost more. If size and elegance doesn't matter, use a bunch of these low-cost Arduinos, stick it to a base plate, and interconnect it with jumper wires, at least for a prototype.
So Long, and Thanks for All the Fish
Electronics, hiking, retro-computing, electronic music etc.: https://www.youtube.com/c/FrankBussProgrammer
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf