Electronic Nano Master Mind

by maodnt. in Circuits > Arduino

1466 Views, 16 Favorites, 0 Comments

Electronic Nano Master Mind

IMG_3349.jpg
Nano Master Mind.jpg
thumbnail_IMG_2908.jpg
thumbnail_IMG_2909.jpg
thumbnail_IMG_2911.jpg
thumbnail_IMG_2912.jpg
thumbnail_IMG_2913.jpg
thumbnail_IMG_2914.jpg
thumbnail_IMG_2915.jpg
thumbnail_IMG_2916.jpg
score.gif
IMG_3350.jpg
Guess_Select.gif

Versione elettronica portatile del famoso gioco degli anni 70, dove bisognava decodificare un codice a 4 colori composto dall'avversario (scelti fra 6 colori diversi) , ad ogni tentativo l'avversario indicava il numero di colori corretti nella posizione corretta e il numero di colori corretti nella posizione sbagliata. Attraverso questi aiuti il giocatore si avvicinava alla soluzione. Il numero di tentativi disponibili erano predeterminati, superati quelli senza aver indovinato si perdeva, al contrario si vinceva. Negli anni hanno prodotto svariate versioni con codici più complessi oppure numeri al posto dei colori, la mia versione utilizza appunto i numeri.

Il codice, da me realizzato con Arduino segue queste regole:

Ad ogni avvio il gioco genera un numero casuale a tre cifre che, tramite il tasto "A" può essere modificato fino a 6 cifre, ad ogni pressione del tasto "A" si incrementa di una cifra fino a 6, qundi torna a 3 (diciamo in modo ciclico).

Scelta la complessità del codice segreto si può già inserire il primo tentativo che andrà confermato con il tasto "B", se si sbaglia a digitare, prima di confermare con "B" si può cancellare la cifra con il tasto "C" e digitare poi quella voluta. Confermato il tentativo verrà mostrato a video un FEEDBACK del codice tentato, (in modo analogo alla versione elettronica "Invicta Electronic Master Mind" prodotta sempre negli anni 70), cioè, appariranno 2 cifre: La prima cifra a sinistra sotto il "FLAG" indicherà la quantità di cifre indovinate nella posizione corretta, mentre la cifra a destra sotto la "X" indicherà la quantità di cifre corrette ma nella posizione sbagliata.

es.

Scelgo di giocare con un codice a tre cifre

codice segreto generato e che non conosciamo: 951

tentativo 123, Feedback 01 (un numero indovinato (1) ma non si trova nel posto corretto)

tentativo 456, Feedback 10 (un numero indovinato e nel posto corretto (5))

tentativo 789, Feedback 01 (un numero indovinato (9) ma non si trova nel posto corretto)

tentativo 159, Feedback 12 (un numero indovinato e nel posto corretto (5), due indovinati ma nel posto sbagliato (1 e 9)

tentativo 195, Feedback 03 (i numeri ci sono tutti (1-9-5) ma si trovano tutti nei posti sbagliati)

tentativo 951, Feedback 30 (i numeri adesso sono tutti nei posti corretti, Hai Vinto!)

il gioco tiene conto e memorizza quanti tentativi il giocatore utilizza per arrivare alla soluzione.


Quindi i tasti per giocare sono:

"A" Modifica in modo ciclico la lunghezza del codice segreto (da 3 a 6).

"0 a 9" selezione del codice segreto.

"B" Conferma il codice da tentare.

"C" Funziona come un tasto BackSpace, per correggere inserimenti non voluti.

"D" Abbandona la partita, visualizza il codice segreto attuale (non indovinato), e i tentativi utilizzati fino a quel punto.

" * " Visualizza i record "Score" per ogni lunghezza codice (3-4-5 oppure 6), i record rimangono a video per qualche secondo. (sono memorizzati nella eeprom).

Una volta indovinato il codice quindi vinto la partita, verrà visualizzato il codice segreto e il numero di tentativi utilizzati.

Per continuare da stati non giocabili (es. splash screen o riepilogo vincita) premere un tasto qualsiasi.

Contiene un Display 1602 I2C ed un Ardunio Nano con porta USB-Micro. La tastiera è una 4X4 a membrana.

Il gioco funziona con 3 batterie AA. Non ho voluto di proposito fare circuiti di caricamento con batterie al litio ricaricabili, innanzitutto per mantenere dove potevo lo spirito vintage, e poi visto il consumo non aveva molto senso.

Ma vediamo cosa serve e come realizzarlo...


Portable electronic version of the famous game of the 70s, where it was necessary to decode a 4-color code composed by the opponent (chosen from 6 different colors), with each attempt the opponent indicated the number of correct colors in the correct position and the number of correct colors in the wrong position. Through these aids the player got closer to the solution. The number of attempts available was predetermined, if you passed those without guessing you lost, on the contrary you won. Over the years they have produced various versions with more complex codes or numbers instead of colors, my version uses numbers.

The code, which I created with Arduino follows these rules:

At each start the game generates a random three-digit number which, using the "A" key, can be changed to up to 6 digits; each time the "A" key is pressed it increases by one digit up to 6, and then returns to 3 (let's say cyclically).

Once you have chosen the complexity of the secret code you can already enter the first attempt which must be confirmed with the "B" key; if you make a typing error, before confirming with "B" you can delete the digit with the "C" key and then type the desired one. Once the attempt is confirmed, a FEEDBACK of the attempted code will be displayed on the screen (similar to the electronic version "Invicta Electronic Master Mind" also produced in the 1970s), i.e. 2 digits will appear: The first digit on the left below the "FLAG" will indicate the quantity of digits guessed in the correct position, while the digit on the right under the "X" will indicate the quantity of correct digits but in the wrong position.

for example.

I choose to play with a three-digit code

secret code generated and which we do not know: 951

attempt 123, Feedback 01 (a number guessed (1) but not in the right place)

attempt 456, Feedback 10 (a number guessed and in the right place (5))

attempt 789, Feedback 01 (a guessed number (9) but not in the right place)

attempt 159, Feedback 12 (one number guessed and in the right place (5), two guessed but in the wrong place (1 and 9)

attempt 195, Feedback 03 (the numbers are all there (1-9-5) but they are all in the wrong place)

attempt 951, Feedback 30 (the numbers are now all in the right place, you win!)

the game takes into account and memorizes how many attempts it takes the player to arrive at the solution.


So the keys to play are:

"A" Cyclically modifies the length of the secret code (from 3 to 6).

"0 to 9" secret code digit.

"B" Confirm the code to attempt.

"C" Works like a BackSpace key, to correct unwanted entries.

"D" Exits the game, displays the current secret code (not guessed), and the attempts made up to that point.

" * " Displays the "Score" records for each code length (3-4-5 or 6), the records remain on the screen for a few seconds. (they are stored in the eeprom).


Once you have guessed the code and therefore won the game, the secret code and the number of attempts made will be displayed.

To continue from non-playable states (e.g. splash screen or victory summary), press any key.

Contains an I2C 1602 display and an Ardunio Nano with USB-Micro port. The keyboard is a 4X4 membrane.

The game runs on 3 AA batteries. I deliberately didn't want to create charging circuits with rechargeable lithium batteries, first of all to maintain the vintage spirit where I could, and then given the consumption it didn't make much sense.


But let's see what is needed and how to achieve it...

Supplies

tastiera.jpg
Portabatterie.jpg
Interruttore.jpg
Display_1602.jpg
Arduino_Nano.jpg
71mVZb0XLfL._SL1500_.jpg

Arduino nano (clone) con porta USB-Micro

Display LCD 1602 I2C

Tastiera a membrana 4X4

Porta batterie 3xAA LR6

Interruttore 2 Posizioni SPDT 3Pin


Convertitore Step Up MT3608 Opzionale ma consigliato... Optional but recommended...

Sebbene il tutto sembra funzionare bene anche a 4.5V, il display rende di più a 5V, quindi ho aggiunto un alimentatore Step Up regolato a 5V. Avrei potuto utilizzare 4 Batterie e risolvere il problema, ma avrebbe aumentato l'ingombro, e sinceramente è già abbastanza grande così.

Although everything seems to work well at 4.5V, the display performs better at 5V, so I added a Step Up power supply regulated at 5V. I could have used 4 batteries and solved the problem, but it would have increased the bulk, and honestly it's already quite big as it is.


Pin Header 2.54mm da 8 pin.

Io sinceramente ho usato quelli trovati nella scatola dell'Arduino Nano che sono da 15 pin (tagliatelo a misura)

I honestly used the ones found in the Arduino Nano box which are 15 pins (cut it to size)


Viti autofilettanti M2 Ho usato queste ma vanno bene anche simili.

I used these but similar ones are fine too.


Cavi vari (io utilizzo AWG30)


Saldatore

Welder

Circuit Diagram

Screenshot 2024-03-22 151731.png
IMG_3362.jpg
IMG_3365.jpg
IMG_3366.jpg

Nelle immagini, lo schema di collegamento di tutti i componenti e il montaggio reale.

Saldare gli 8 cavi al pettine da 8 pin e quindi all'Arduino Nano (da D2 a D9) rispettando lo schema (attenzione all'ordine corretto), controllate più volte, se sbagliate non esplode nulla ma nulla funzionerà come deve. Se il tastierino funziona male è probabile che abbiate inserito il connettore al rovescio, provate a girarlo.

Cablate anche il display al Nano come indicato. (SDA>A4 / SCL>A5 / GND>GND / VCC>VIN)

In ogni caso si può cablare tutto prima di inserire i componenti nelle parti.

Isolate i punti scoperti per evitare probelmi.


In the images, the connection diagram of all the components and the actual assembly.

Solder the 8 cables to the 8-pin comb and then to the Arduino Nano (from D2 to D9) respecting the diagram (pay attention to the correct order), check several times, if you make a mistake nothing explodes but nothing will work as it should. If the keypad works badly it is likely that you have inserted the connector backwards, try turning it.

Also wire the display to the Nano as indicated. (SDA>A4 / SCL>A5 / GND>GND / VCC>VIN)

In any case, you can wire everything up before inserting the components into the parts.

Isolate exposed points to avoid problems.

Printing Parts

IMG_3372.jpg
IMG_3373.jpg
IMG_3374.jpg
IMG_3375.jpg
IMG_3376.jpg
IMG_3377.JPG
IMG_3378.JPG

Le parti si possono stampare in PLA del colore che volete, spazio alla fantasia.

Nelle immagini si vede chiaramente come le ho orientate rispetto al letto di stampa. Il layer si può tenere tranquillamente al classico 0.2mm, ricordate di attivare il supporto. Visto la fragilità della leva di chiusura del coperchio batteria, prima di utilizzarlo vi consiglio di applicare una striscia di nastro isolante nella curva della levetta e inserire nella fessura uno spessore di gomma piuma, nelle foto dovrebbe vedersi chiaramente. Questo accorgimento serve per non romperlo al primo utilizzo.

In ogni caso se avete dimestichezza con il CAD e voglia di sbattervi, è risaputo che tutto è migliorabile. Quindi vedete voi se volete ridisegnarlo. Le altre due parti ritengo che siano già a posto così.


The parts can be printed in PLA in the color you want, go with imagination.

In the images you can clearly see how I oriented them with respect to the print bed. The layer can easily be held at the classic 0.2mm, remember to activate the support. Given the fragility of the battery cover closing lever, before using it I recommend applying a strip of insulating tape in the curve of the lever and inserting a layer of foam rubber into the slot, it should be clearly visible in the photos. This is to avoid breaking it the first time you use it.

In any case, if you are familiar with CAD and want to mess around, it is well known that everything can be improved. So see if you want to redesign it. I think the other two parts are already in place as is.

Assembly

Screenshot 2024-03-22 112415.png
Screenshot 2024-03-22 113054.png
FRJEJUMLU2O8FWS.jpg
IMG_3368.jpg
IMG_3361.jpg
IMG_3360.jpg
IMG_3369.jpg
IMG_3380.jpg

Il Portabatterie viene venduto con due fori di fissaggio nella parte centrale, sotto quei fori passerà il flat cable del tastierino, quindi andranno realizzati dei fori nuovi, operazione veloce. Nelle immagini ci sono le indicazioni di dove praticare i fori. Ricordarsi di svasare i fori dal lato batterie. Vedi immagini

Togliere la pellicola di protezione dell'adesivo del tastierino numerico, e dopo aver fatto passare il cavo piatto attraverso l'intaglio della parte frontale, posizionare il tastierino come mostrato in foto. La parte frontale è ok adesso giriamo la parte per inserire il resto dei componenti.

Avvitare il Display come indicato, utilizzando due viti M2X5, inserire l'interruttore facendo passare la leva nella finestrella quindi premendo il corpo in sede, con la punta del saldatore deformare leggermente la sede in PLA per bloccarlo (oppure utilizzate una goccia di colla a caldo). La stessa procedura anche per la scheda Arduino Nano.

Piegate il cavo flat del tastierino e posizionatelo sotto il portabatterie, quindi avvitate il porta batterie con le quattro viti M2x5.

Posizionate lo Step-Up come indicato, collegate io connettore del tastierino, quindi facendo attenzione ai cavi chiudere il tutto con il coperchio posteriore serrando il tutto con le sei viti M2x10. Stringete senza esagerare.

Le Batterie possiamo metterle dopo la programmazione dell'Arduino.


The battery holder is sold with two fixing holes in the central part, the flat cable of the keypad will pass under those holes, therefore new holes will have to be made, a quick operation. In the images there are indications of where to drill the holes. Remember to countersink the holes on the battery side. See images

Remove the protective film from the numeric keypad sticker, and after passing the flat cable through the notch on the front, position the keypad as shown in the photo. The front part is ok now let's turn the part to insert the rest of the components.

Screw the display as indicated, using two M2X5 screws, insert the switch by passing the lever through the window then pressing the body into place, with the tip of the soldering iron slightly deform the PLA seat to block it (or use a drop of hot glue ). The same procedure also applies to the Arduino Nano board.

Fold the flat cable of the keypad and place it under the battery holder, then screw the battery holder with the four M2x5 screws.

Position the Step-Up as indicated, connect the keypad connector, then, paying attention to the cables, close everything with the rear cover, tightening everything with the six M2x10 screws. Tighten without exaggerating.

We can put the batteries after programming the Arduino.

Arduino Program

Screenshot 2024-03-22 161528.png
Screenshot 2024-03-22 161925.png

Per caricare il codice .hex basta un cavo USB micro, cercate e scaricate il software "AVRDUDESS" ed impostarlo come nell'immagine.

Per azzerare la memoria eeprom per eliminare eventuali record presenti, caricare prima il file (eeprom_eraser.hex), il display del gioco indicherà l'avvenuta cancellazione.

A questo punto potete caricare il file del programma (NanoMasterMind_v3.hex).

Se tutto è andato bene, dopo aver rimosso la presa usb e aver messo le 3 batterie AA nel modo corretto, dovreste avere il gioco funzionante.

Chiedo scusa in anticipo per eventuali errori, inoltre la versione Inglese è tradotta automaticamente, quindi sarà piena di errori.

Ora... Chiudete il vano batteria e buon divertimento.


Infine dichiaro che non mi ritengo responsabile di danni di qualsiasi natura essi siano, a persone o cose derivanti da questa guida. Siete liberi di non seguirla.

MDN


To upload the .hex code, all you need is a micro USB cable, search and download the "AVRDUDESS" software and set it as in the image.

To reset the eeprom memory to eliminate any records present, first load the file (eeprom_eraser.hex), the game display will indicate the deletion.

At this point you can load the program file (NanoMasterMind_v3.hex).

If everything went well, after removing the USB plug and inserting the 3 AA batteries correctly, you should have the game working.

I apologize in advance for any errors, also the English version is automatically translated, so it will be full of errors.

Now... Close the battery compartment and enjoy.


Finally, I declare that I am not responsible for damages of any nature to people or things resulting from this guide. You are free not to follow her.

MDN