Searching \ for 'What's in the train? The whole story.' in subject line. ()
Help us get a faster server
FAQ page: www.piclist.com/techref/index.htm?key=whats+train+whole
Search entire site for: 'What's in the train? The whole story.'.

Truncated match.
'What's in the train? The whole story.'
1999\10\13@005536 by

Ok, since this post has gotten so many replies and gone off on more
tangents than i thought possible I'll give the concept I'm working on.  And
maybe clear up some of the confusion that has arisin from my analogy.

The real project is designing "smart" building-blocks.  Around the size
of Duplo blocks or other large "Lego" like blocks.  The goal is to create a
set of blocks that can do math when connected in a correct order.  There
will be number blocks, addition, subtraction, multiplication, and division
blocks.  All of them are like the cars in the train.  The Equals block works
like the engine to gather the order and type of block conected to it and
computer the equation.  With such a small size, electrical contacts seem the
most inexpensive way to go.  My buget is as low as I can make it.  The lower
the better.  I went for a PIC that would just meet my needs (at \$.90
wholesale) and plastic and phone jack connectors for my contacts.  The block
is being desiged by another group memeber but we are looking at cents each.
The blocks cannot be plugged in backwards, they have a front and back.

Dan Larson made a nice picture to illustrate this

-----     -----     -----     -----     -----
|   |---->|   |---->|   |---->|   |---->|   |
| 7 |     | = |     | 5 |     | + |     | 2 |
|   |<----|   |<----|   |<----|   |<----|   |
-----     -----     -----     -----     -----

Speed is pretty much not an issue, under a second is fine. In reality it
should do it in a fraction of that.

The Equals block is going to be an impresive bit of code, we have a lot more
blocks than just numbers and simple math.  Since all the others are just
slaves with an ID code, it all lies in there.

If anyone has any input still,  I'm still open.  This is the second try at
this project, now with a PIC chip and i hope i can acomplish my goal.

-Stu

oh - OK.  no choo choo involved.

How about a slightly different scheme.

My cool scheme was a light pipe connecting the blocks as a common
bus (so no electrical connection), but your need to find order counts
that out.

You don't need the 'up and back' scheme. you can do it with
one way communication.

each non "=" sign module transmits to left and receives to right.
At some interval t the module transmits a 'suppress' signal.
If the module doesn't see a suppress signal in, say, 3t, it
transmits it's ID number followed by EOM signal.
A module seeing a valid ID number retransmits it.
A module seeing an EOM transmits it's ID, then the EOM.
Data comes to "=" sign module nearest module first, EOM terminated,
ignore the suppress messages (which might themselves be useful
to suppress the "wrong" indication when nothing is plugged in).

You might try to locate a cheap LED and photosensor source,
that'd be way more reliable than contacts.

> Dan Larson made a nice picture to illustrate this
>
>
> -----     -----     -----     -----     -----
> |   |---->|   |---->|   |---->|   |---->|   |
> | 7 |     | = |     | 5 |     | + |     | 2 |
> |   |<----|   |<----|   |<----|   |<----|   |
> -----     -----     -----     -----     -----

You wouldn't be able to reorganize this in such a way that:

----------   ----------
|        |   |        |
|    7   |   |    5   |
----------   ----------
V      V
----------
|        |
|     +  |
----------
V
----------
| display|
|     =  |
----------

Would you?  This way you would be taking the expression and building
an evaluation tree.  Allows for much more complex expressions.  Maybe
this is more like "comp sci" blocks rather than something simple to
teach basics to children.  But it *really* reduces the coding problem.
No block ID codes, no "who's there" problem.  The blocks only have to
talk to adjacent blocks and pass down the result.

Chris

Azrael wrote:
>     The real project is designing "smart" building-blocks.  Around the size
> of Duplo blocks or other large "Lego" like blocks.  The goal is to create a
> set of blocks that can do math when connected in a correct order.  There
> will be number blocks, addition, subtraction, multiplication, and division
> blocks.  All of them are like the cars in the train.  The Equals block works
[snip]

Ok Azrael, now you just said that you can not have any electric contact
exposed, if this thing goes to be around children 3 or younger, even if
it is intended to 6 and older.

Here the suggestion is just use a coded holes or reflective mark
combination on the bottom of each block, it will means its "function",
number, math operator, etc, and then it should be positioned over a
"master" calculator bed, template, board, whatever.  The board identify
what is on top of it and do the math.

By this way, no electrical nothing on each module, and all the
electronics and batteries will be closed inside this strange
calculator... :)

Just to make little gizmos inside your brain;  I saw years ago a math
calculator using only a light beam (today it would be a laser)...and
function + number (trasparent) blocks using just reflective + prisms +
mirrors inside.  It worked just as easy as a regular "slide ruller", you
can think it to be an electronic abacus.

When using an ADD block, it just shift the original light beam position,
while a MULT block change the beam angle. Just think about a round
calculator, like a 10 hours clock, with really two hands, the short one
is the tens, while the long one is the units.

Wagner.

----- Original Message -----
From: Azrael <dunsmsRPI.EDU>
To: <PICLISTMITVMA.MIT.EDU>
Sent: Wednesday, October 13, 1999 5:53 AM
Subject: What's in the train? The whole story.

>     Ok, since this post has gotten so many replies and gone off on more
> tangents than i thought possible I'll give the concept I'm working on.
And
> maybe clear up some of the confusion that has arisin from my analogy.
>
>     The real project is designing "smart" building-blocks.  Around the
size
> of Duplo blocks or other large "Lego" like blocks.  The goal is to create
a
> set of blocks that can do math when connected in a correct order.  There
> will be number blocks, addition, subtraction, multiplication, and division
> blocks.  All of them are like the cars in the train.  The Equals block
works
> like the engine to gather the order and type of block conected to it and
> computer the equation.  With such a small size, electrical contacts seem
the
> most inexpensive way to go.  My buget is as low as I can make it.  The
lower
> the better.  I went for a PIC that would just meet my needs (at \$.90
> wholesale) and plastic and phone jack connectors for my contacts.  The
block
> is being desiged by another group memeber but we are looking at cents
each.
{Quote hidden}

more
> blocks than just numbers and simple math.  Since all the others are just
> slaves with an ID code, it all lies in there.
>
> If anyone has any input still,  I'm still open.  This is the second try at
> this project, now with a PIC chip and i hope i can acomplish my goal.
>
> -Stu
>

This is by no means a trivial problem, and most of the posts I've read seem
to go off into the ins and outs of data comms between blocks, and how this
is best implemented.

For my part, I think that an analysis of the functionality should be your
first objective.

No one appears to have mentioned the problem of determining the correct
mathematical syntax.  i.e number-operator-number-equals-number(and possibly
more operators & numbers)

If you are going to model an equation, it would seem prudent to allow the
equal block to be the master in the system.  You could then interogate
exressions to the left and right and check for equality (and correct
syntax). This cuts out the need for anything but the most simple display
indicator, perhaps a bi-colour LED. You might wish to reward an equality
with a pleasing tune, and errors mathematical or syntax with other tones
(easily done with the lowliest PIC).

You may be able to prevent syntax error mechanicaly by keying the blocks
such that a connection cannot be made between two operators for example.
This would simplify the code.  On the other hand, you may deliberately want
to allow syntax errors to improve the learning content of the toy.

I assume you wish to operate with integers, but this throws up a problem
with division. Also there is the problem of operator precedance with
division and subtraction as x/y <> y/x and x-y <> y-x.  This necesitates
that each be able to determine its position within the expression and pass
this to the master directly or to its neighbour for onward transmission.
The far left block, having an unloaded port, could pass a data byte to the
right, the next block adding its own data byte, passing two data bytes to
the right, the next block adding its data etc, etc ... Until the data string
(of whatever length) hits the equal block for processing.
An identical method could be used for reading to the right of equal block.
A simple charcter based start/stop protocol would be perfectly adequate.

This bucket brigade type approach would appear to be the only solution as
you have only the open ends and the blocks adjacent to the master as
positional references.  An asynchrous system would not be able to determine
position, as you have no knowledge of which block is answering the
interogating call.

There is also the aspect of two digit numbers - are two adjacent number
blocks to be considered as a two digit number?  Again this would require to
master to have positional knowledge of the blocks.

It may be helpful to restrict you spec, if you need to get a conceptual
demonstrator up and running quickly. I make no attempt to suggest a detailed
method of implementation here, as there as many equaly valid approaches.
Ask ten engineers - get eleven possible solutions !

Congrats on an interesting and thought provoking post !  This list needs
more of these !

Good PIC'in

Mick

>No one appears to have mentioned the problem of determining the correct
>mathematical syntax.  i.e number-operator-number-equals-number(and possibly
>more operators & numbers)

That is a good point, but I think that we've all designed parsers and
lexical analyzers here, so it shouldn't be any more than a "go back to high
school computer class" to resolve it.  The parser/interpreter also handles
the other points you made about multi-digit numbers, precedence, etc.

>If you are going to model an equation, it would seem prudent to allow the
>equal block to be the master in the system.  You could then interogate

Excellent idea!

Andy

==================================================================
Eternity is only a heartbeat away - are you ready?  Ask me how!
------------------------------------------------------------------
andyrc-hydros.com      http://www.rc-hydros.com     - Race Boats
==================================================================

Michael Lee wrote:
[snip]
> For my part, I think that an analysis of the functionality should be your
> first objective.
> No one appears to have mentioned the problem of determining the correct
> mathematical syntax.  i.e number-operator-number-equals-number(and possibly
> more operators & numbers)
[snip]

Well, you are right, but this issue should be solved *after* he solve
the connectivity problems.
Any module can be the server, it doesn't matter so much, if the server
can talk to all modules, and understand the formula complexity by
observing the modules disposition.

In real, the server can be not even connected to the modules, if using
some kind of wireless communication. If it needs to be there physically,
and thinking that in each formula there is at least and only one "="
sign, then it is the best candidate to be the server, just for this
reason.

Of course he needs to define the modular logic. As a gross example of
the the analog calculator, he could use just resistors inside of the
"number" modules, any add or subtract operation should be equal balanced
in both sides of the "=" sign, that can be as simple as a balanced
bridge that can turn a red light whenever it is not balanced. In the
analog calculator, each "operator block" computes its own results and
feed other operators, so the "=" operator does the final accounting.

In the digital idea, after the physical disposition and electronic
identification is done, it is not different than do a simple math
calculation using a syntax checking algorithm.

I think its major problem right now, is to develop a communication
technique that challenges a skinny 5 years old boy with his hands full
of melted chocolate and accidentally pouring orange juice at the
connectors, then, trying to connect those modules, by force, to his Lego
blocks.  If you never had accidents with orange juice in electronics...
consider yourself a happy person.

There are some interesting connectors at the market, just take a look at
what the "masters" use, like Nintendo and Sega games pads connectors,
but the blocks would end up costing more than \$5.00 each and will demand
a nice and undestrutive inject molded case, with or without batteries.
It is not an easy task.  The use of 2 or 6 connector pins, doesn't
change so much the cost as you can imagine.  If he can solve the
connection problem, *here goes the best solution* I can think for a
while:

-----------------------------------------
Less than \$0.50 of electronics per module
Less than \$6.00 of electronics per master
-----------------------------------------

I would suggest a "serial bit ring technique", using a simple parallel
to serial shift register in each block with the parallel inputs tied
up/down according to the representative code of each block. A 4 bits
chip allows 16 combinations, enough to do all the 0-9 digits plus "+ - /
* % =".

The master block (powered by a PIC and batteries) installed at the far
left (always) of the equation, does supply power to the serial loop, all
the module's shift registers will load its value (at power on) and then
PIC step out "sqr sqr % sqr sqr" (FFEFF) code to the modules close to
it, and steps in as many bits he needs until he receives back the FFEFF,
so he will have the math formula representation immediately from both
sides of the "=" module. The non returning of FFEFF after 100 step
clocks means the loop is open.

Each module should has only 6 pins (Vcc, Gnd, GndRet, Clock, Data and
DataReturn) at each side (to propagate the signal).  The GndRet at the
left side connector is just a tied down, so it can tells the module at
its left "I am here".  In the absence of this signal, the module
automatically connects Data to DataReturn wires, using a transistor,
gate logic, whatever is low cost. This is an auto-loop-back.

74HCT194/195 are a nice 4 bits solution. A simple capacitor serving the
"LOAD parallel bits" into the shift register at power on.

All the electronics at the master (to read the rings) would be just 2
transistors to switch power to the rings and 6 port I/O pins, 3 per side
(clock, data out, data in), that's it.  What the software needs to do is
just steps out 20 bits "FFEFF" at data out pin, and keep stepping out
(any) bits until FFEFF arrives at the data in, for both sides, that's
all.

It should cost less than \$0.50 in electronics per module, no oscillators
or resonators, while the server uses less than \$6.00 in electronics with
a PIC (probably less than \$4.00 with an Atmel, or less than \$2.50 with a
small Zilog), plus the audible/visual feedback, etc.

Want to turn it into a scientific calculator? just use 8 bit shift
registers, and you will have 10 digits plus 246 different operators..
74HCT165 :)

A MODULE DRAWING:
-----------------

+VCC                                                        +Vcc
>-------------------o------------------------------------------>
|
StepClock           |                                  StepClock
>------------------------o------------------------------------->
|    |
.--------------------------------.
Data In     |                                |          Data Out
>-----------|       shift register           |------o---------->
|       coded as "7"             |      |
'--------------------------------'      |     +Vcc
|    3    2    1    0   Load         |      |
|    |    |    |    |    |           |      R
|    |    |    |    |    |           o      R
GndRet         |   Gnd   +    +    +   ---           \     |
<--------------o                       ---     4066   \<---o--<
|                        |           o  \  GndRet
Ground         |                        |           |
>--------------o------------------------o---------------------<
|                                    |    Ground
Gnd                                   |
DataReturn                                          | DataReturn
<---------------------------------------------------o---------<

Cap at Vcc and a pullup resistor at Load.

Can we start the production?  :)

Wagner.

Wagner Lipnharski wrote:
> <snipped>
> Each module should has only 6 pins (Vcc, Gnd, GndRet, Clock, Data and
> DataReturn) at each side (to propagate the signal).  The GndRet at the
> left side connector is just a tied down, so it can tells the module at
> its left "I am here".  In the absence of this signal, the module
> automatically connects Data to DataReturn wires, using a transistor,
> gate logic, whatever is low cost. This is an auto-loop-back.

Resistor, would be my thought?  Should work well & cheaply, say 10k or
so, then the switching's done "auto-magically."  A pic output pin, or
74HC logic, can overcome a 10k resistor <G>  Fewest parts solution <G>

Mark

I would have thought something along this lines was more efficient. If only
due to the fact every block has intelligence. If all it's doing is passing
messages that's a bit of smarts not being used. The other advantage is as
was stated, the equals block has to have ALL the logic. i.e. if you add say
a multiplication block, it will only work with equals blocks aware of the
existence of the multiplication block. However, if it is the multiplication
block that knows what multiplication is then all the equals block needs to
know is that some other block will give it data (2 blocks I guess). It
slightly depends on what happens. If they connect say 3 + 4 = 5, what
happens, does a red light on the equals block light?

Having an expression tree style process will reduce alot of complexity as
well. For instance a X - Y = Z sequence, with all intelligence in the equals
block, it needs to determine the exact order, to know whether to do X - Y or
Y - X, it then needs to know how to do X - Y. However, if the minus block
has this intelligence, it just knows it subtracts the block to the left from
the block to the right. You'd need bidirectional communication so the minus
block could find out about the Y block but that was on the cards any way. In
the above example, a pulse would be passed from the initiating block (i.e.
the kid pushes a button on the equals block (or the equals block detects a
block on each side (I'd say press a button to allow parent\child interaction
etc "Are you sure 4 + 5 = 8?"))) down the chain.
The euals block would send to the left, the Y block would transmit it's
value, the - block would record this value as it was one hop to the right,
it would then send a fresh message to the left, the X block would try and
send it's value to the left and find an open circuit (timeout) so it would
instead send it to the right, the minus block would record this as it's
second value as it was one hop to the left. It would then calculate X - Y
and send it right again, the Y block, not wanting input would ignore it and
not increment the hops. Hence the equals block would get 'X-Y' as a message
from one hop to the left. A similar process happens on the right hand side,
now the equals block has the evaluation of the LHS and RHS without doing any
calculation. That way the - block could be replaced with any binary op
without change to any other block.

Still not a lot of work for a PIC, but for 0.90c...

Very nice idea I must say, If I had kids I'd be pretty interested (however
at 20yrs I'm not holding my breath).

Tom.
{Original Message removed}
Mark Willis wrote:
>
> Wagner Lipnharski wrote:
> > <snipped>
> > Each module should has only 6 pins (Vcc, Gnd, GndRet, Clock, Data and
> > DataReturn) at each side (to propagate the signal).  The GndRet at the
> > left side connector is just a tied down, so it can tells the module at
> > its left "I am here".  In the absence of this signal, the module
> > automatically connects Data to DataReturn wires, using a transistor,
> > gate logic, whatever is low cost. This is an auto-loop-back.
>
> Resistor, would be my thought?  Should work well & cheaply, say 10k or
> so, then the switching's done "auto-magically."  A pic output pin, or
> 74HC logic, can overcome a 10k resistor <G>  Fewest parts solution <G>
>
>   Mark

Hey Mark, I thought to use a simple resistor, but if the equation
expression is 1234+1234-123+12345=14936 it will have 25 resistors
driving each shift register output directly to the DataReturn wire... so
you can think almost 25 in parallel... its a pitty, but it needs an
active loop-back to be active just at the very end module...  A
mechanically activated switch would be nice... but... remember the 5 yrs
old skinny frekles face boy poking the connector with a pencil.  I
thought also to use a transistor open collector to drain the loop-back
wire, base polarization cut off by the GroundRet from the next module,
if no next module it floats, the transistor then will follow base
polarization by a second resistor connected to Data Out pin....the PIC
needs to understand that the DataReturn wire has an inverted data bit
signal, also easy to do, right?

I still reading posts solutions about to turn each "operator module"
somehow inteligent, when it doesn't need it.  The main point here is
just to transport the math expression sequenced by the blocks into just
one inteligent block that will do the simple math.  It is just a
sequential input of digits and operators and a simple syntax
pre-evaluation to make multiplication and division first, and evaluate
the result at the left side of the "=" module with the right side, as
well, to check if operator modules are unique between numbers, to avoid
1234+-1234 or 1234*/1234 or similar errors.

It is the same as if you are inputing an equation to a calculator in
serial mode, nothing else, pretty and simple.  Sincerelly, this is a one
hour assembler programming and it's done.

Wagner.

I haven't been paying attention so perhaps this has been mentioned before,
but why don't you send a "packet" from your "=" block, and have each block
it passes through on the "ring" add the TEXT of the block value to the
packet, a sort of "record route" function.  When the packet gets back to
the "=" block, You'll have a text expression that can be computed using
standard math parsing routines.

BillW

>  You may be able to prevent syntax error mechanicaly by keying the blocks
> such that a connection cannot be made between two operators for example.
> This would simplify the code.  On the other hand, you may deliberately
want
> to allow syntax errors to improve the learning content of the toy.

Tricky,  7 = 8 + -1 is legal.

Azrael wrote:

>The real project is designing "smart" building-blocks.
Azrael, I don't know if it will help with your project (which is GREAT by
the way), but just in case, you should look at

fredm.http://www.media.mit.edu/people/fredm/projects/ab/

This is a sketch of a project that "instruments" lego blocks, such that a
computer could track a construction. There are good ideas here, using a
simple resistor to identify blocks, etc.

If nothing else, I'm sure it will be an interesting read for you :-)

Dave Johnson

Wagner Lipnharski wrote:
>
> Mark Willis wrote:
> >
> > Wagner Lipnharski wrote:
> > > <snipped>
> > > Each module should has only 6 pins (Vcc, Gnd, GndRet, Clock, Data and
> > > DataReturn) at each side (to propagate the signal).  The GndRet at the
> > > left side connector is just a tied down, so it can tells the module at
> > > its left "I am here".  In the absence of this signal, the module
> > > automatically connects Data to DataReturn wires, using a transistor,
> > > gate logic, whatever is low cost. This is an auto-loop-back.
> >
> > Resistor, would be my thought?  Should work well & cheaply, say 10k or
> > so, then the switching's done "auto-magically."  A pic output pin, or
> > 74HC logic, can overcome a 10k resistor <G>  Fewest parts solution > <snippe
d>
> Hey Mark, I thought to use a simple resistor, but if the equation
> expression is 1234+1234-123+12345=14936 it will have 25 resistors
> driving each shift register output directly to the DataReturn wire... so
> you can think almost 25 in parallel... its a pitty, but it needs an
> active loop-back to be active just at the very end module...

I thought the inputs were PIC pins, set as inputs on code startup, then
as things are figured out, they're set (one by one) as outputs, as
appropriate - Thus a 10k or so resistor would be just fine.  (i.e. a PIC
in each block, with Data Out connected to Data In through said resistor,
if another PIC is to the right it's output pin drives the Data In line,
quite well.  Shouldn't be crosstalk problems, even <G>)  If you have
just one output & the Data line's bussed through all blocks, then you
need an end mounting cap or something (Maybe have this end cap hold the
whole equation in place, and have parentheses do the same, on a plug-in
rail that busses Vcc and Ground to all the blocks?)

Myself, I'm concerned with how to make sure your rightmost (and/or
leftmost) blocks have a good solid ground, and decent Vcc, I'm thinking
a regulator on each block & a 78L05 per block, say 9VDC power in, this
would raise the price somewhat but you could then have cheaper
connectors with higher resistances, perhaps?  (Have an LED on each PIC
chip that glows amber when the block has proper power, WDT turns this
LED off for 1/2 second or so (as would power-up) so if the amber LEDs
aren't on, you know something's wrong...)  That'd cost somewhat, as
would mounting the LED, cheaper than a VReg though.  Maybe just VReg the
"=" blocks, and have the Equals signs not come on for 1/2 second after a
cold / warm / Watchdog startup, so you know there's a problem.

Mark

More... (looser matching)
- Last day of these posts
- In 1999 , 2000 only
- Today
- New search...