Author Topic: TinyTuring - A Turing machine on an Arduino  (Read 13228 times)

0 Members and 1 Guest are viewing this topic.

Offline Spyro543

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1189
  • Rating: +74/-3
    • View Profile
TinyTuring - A Turing machine on an Arduino
« on: May 25, 2015, 11:56:14 am »
TinyTuring
What is it?
TinyTuring is a simulated Turing machine running on my Arduino. More details below:
I/O
Input: 4 buttons (Left, Right, OK, Back)
Output: 16 character, 2 line LCD
Memory
States: 10
Tape size: 16 cells
Picture


Main Menu and Functions
Menu Items
Edit Program - starts programming interface

Run Program - runs program in memory

Edit Tape - the tape can be preset with values before the program is started

Clear Tape - sets all tape cells to 0

Clear Program - erases program in memory

Controls
Left/Right: scroll though menu items
OK: Launch selected menu item
Back: N/A

Edit Program
Description
Select state to edit

Choose to edit what the program will do if it scans a 0 or 1

What the program writes to the tape (0 or 1)

What direction the head will move after writing (0=left, 1=right)

The next state to jump to after this one is done (0=halt program)

These values can be edited, of course

Controls
While selecting state
Left/Right: Scroll through states
OK: Edit selected state
Back: Return to main menu
While selecting symbol scanned
Left/Right: Scroll through possible symbols to scan
OK: Edit instructions based on selected symbol
Back: Return to states
While selecting value to edit
Left/Right: Scroll through values to edit
OK: Edit selected value
Back: Return to symbols to scan
While editing value
Left/Right: Decrement/increment selected value
OK: Save value and stop editing
Back: N/A

Run Program
Description
This mode runs the program written in "Edit Program" mode. The head is represented by a karat symbol ^ .

Program Running in Above Example
Description
This program moves the head to the right and writes '1's to the tape continuously.
Code
State 1, Scan 0
Write: 1
Move: 1
Next: 1
Controls
While program is running
Left/Right: N/A
OK: N/A
Back: Halt program
While program is halted
Left/Right: N/A
OK: N/A
Back: Return to main menu

Edit Tape
Description
This mode is used to preset values in the tape before a program is ran

Controls
Left/Right: Move cursor
OK: Flip bit at cursor
Back: Return to main menu

Clear Tape/Clear Program
Description
These modes clear the tape (set to all '0's) and the program in memory


Controls
Left/Right: Move cursor
OK: Select option at cursor
Back: N/A

Offline SpiroH

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 729
  • Rating: +153/-23
    • View Profile
Re: TinyTuring - A Turing machine on an Arduino
« Reply #1 on: May 25, 2015, 02:30:58 pm »
 A Nice Tiny Turing Toy (NT3) you've got there.  ;)

Suggestion: You still have plenty of space on the breadboard, why don't you plug in some leds to complement the matrix display of zeros and ones.
Instead of using the karat to represent the head, you could just as well make that led blink.

Good job!

Offline Spyro543

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1189
  • Rating: +74/-3
    • View Profile
Re: TinyTuring - A Turing machine on an Arduino
« Reply #2 on: May 25, 2015, 02:56:40 pm »
EDIT: I forgot to respond to you, SpiroH. :P

A Nice Tiny Turing Toy (NT3) you've got there.  ;)
Thanks ;) I might have to use that name instead.

Suggestion: You still have plenty of space on the breadboard, why don't you plug in some leds to complement the matrix display of zeros and ones.
Instead of using the karat to represent the head, you could just as well make that led blink.
That does sound kind of neat. I might consider doing that sometime.

New features!
More states - I realized I have a lot more memory to work with than I thought, so there can now be up to 20 states in a program.

Programs can now be stored on the EEPROM - The Arduino has a 1KB EEPROM in it, so why not store programs to it? Up to 4 programs can be stored on the EEPROM at once.

New menu items for saving and loading programs on the EEPROM:


The interface for selecting program slots:

When doing anything with the EEPROM, the program asks if you are sure you want to do stuff, and gives a confirmation message when finished:

« Last Edit: May 25, 2015, 03:01:49 pm by Spyro543 »

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: TinyTuring - A Turing machine on an Arduino
« Reply #3 on: May 25, 2015, 03:20:15 pm »
Nice thing! You should totally do some Busy beaver fun with it :P

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!

Offline Spyro543

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1189
  • Rating: +74/-3
    • View Profile
Re: TinyTuring - A Turing machine on an Arduino
« Reply #4 on: May 25, 2015, 03:30:42 pm »
Nice thing! You should totally do some Busy beaver fun with it :P
I did a little bit. ;D Slot 2 currently holds a 3-state busy beaver.

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: TinyTuring - A Turing machine on an Arduino
« Reply #5 on: May 25, 2015, 03:32:23 pm »
how do you recognize repeating cycles?

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!

Offline Spyro543

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1189
  • Rating: +74/-3
    • View Profile
Re: TinyTuring - A Turing machine on an Arduino
« Reply #6 on: May 25, 2015, 03:44:40 pm »
how do you recognize repeating cycles?
The TinyTuring itself can't recognize repeating behavior. I just looked up the busy beaver on Wikipedia :P

Offline Spyro543

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1189
  • Rating: +74/-3
    • View Profile
Re: TinyTuring - A Turing machine on an Arduino
« Reply #7 on: June 01, 2015, 11:22:28 am »
Future plans!

I'm going to change up the display and use SpiroH's suggestion. I found two neat displays on Adafruit:



I'm going to use the long LED bargraph display to show the tape, and the 4-digit 14-segment to show the interface for programming it (and everything else the current LCD does, besides show the tape). This will give it a more hardware-y feel IMO, which is what I want to go for.

Offline pimathbrainiac

  • Occasionally I make projects
  • Members
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1731
  • Rating: +136/-23
  • dagaem
    • View Profile
Re: TinyTuring - A Turing machine on an Arduino
« Reply #8 on: June 01, 2015, 11:24:42 am »
That sounds awesome! Are you going to release the source/schematics later?
I am Bach.

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: TinyTuring - A Turing machine on an Arduino
« Reply #9 on: June 01, 2015, 11:42:06 am »
I like the colored LED for the band :D

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!

Offline Spyro543

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1189
  • Rating: +74/-3
    • View Profile
Re: TinyTuring - A Turing machine on an Arduino
« Reply #10 on: June 02, 2015, 03:58:43 pm »
That sounds awesome! Are you going to release the source/schematics later?
I will when it's finished.

Offline SpiroH

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 729
  • Rating: +153/-23
    • View Profile
Re: TinyTuring - A Turing machine on an Arduino
« Reply #11 on: June 09, 2015, 09:26:34 am »
Future plans!

I'm going to change up the display and use SpiroH's suggestion. I found two neat displays on Adafruit:
...
I'm going to use the long LED bargraph display to show the tape, and the 4-digit 14-segment to show the interface for programming it (and everything else the current LCD does, besides show the tape). This will give it a more hardware-y feel IMO, which is what I want to go for.
I like the LED approach. Actually, i really find "Arduino" & "Raspberry Pi" to be a couple of very respectful toys for electronics & computer freaks.

Here are some extra links 'for noobs':

Turing machine on arduino.


Arduino vs Raspberry Pi: Which Is The Mini Computer For You?
http://www.makeuseof.com/tag/arduino-vs-raspberry-pi-which-is-the-mini-computer-for-you/

Arduino Tutorial -  Breadboard and LEDs
http://www.ladyada.net/learn/arduino/lesson3.html

All About LEDs
https://learn.adafruit.com/all-about-leds

Go ahead and implement your future plans ;).