So I'm new to the forum but not arduino, Ive dabbled a bit here and there for the last 5-6 years. Usually I can work my way through issues with a little internet research but I need to control a slightly more complex art piece this time around.
So here's the basic version, It makes more sense if you look at the attached image:
I need to choose a random string of text (2-5 words) off a random page from Wikipedia, then use stepper motors and an engraver to carve this string of text into either a foam or wooden block. This repeats untill the block is full (X amount of character spaces /line) once the block is full the text that has been engraved is crossreferenced with a database to see if the randomly chosen Wikipedia text matches a quote from any of the works of shakespear (probably a one in a million chance)If a match is found the machine stops and a little buzzer sounds, if not, the block is then milled down 1/8th of an inch and new text is engraved. This repeats until the block is only a half inch tall. If no mach has been found the block is ejected, A new one loaded manually and the whole process repeats.
most of the mechanical systems are no problem, I can write the code for limit switches, and triggers no problem. the part that Im running into trouble with involves getting random text and transferring said text to the CNC engraving machine. I have an Ethernet shield but Im not sure how to get it to pull a random Wikipedia page and random text.
Ive built my own CNC routers but none of them where arduino based. I can wire the arduino to breakout stepper drivers and run the motors no problem, Im just not sure how to translate the arduino's SPI text stream into cnc-able data. I'm not against the idea of using more than one board, one for retrieving the text and one for controlling motors, relays etc I have a lot of hardware at my disposal, 3 mega 4 unos, a whole host of shields and components and I'm never against expanding my collection, especially if I can get this done more reliably and quicker Ill spend the money on new toys.
So, Im open to any thoughts, speculation, advice. lets hear it!
Im just not sure how to translate the arduino's SPI text stream into cnc-able data.
My 2 cents: have a file for each CNC character, in your favorite font. For each character to be carved, select the right file and send it to the CNC machine.
As for wikipedia, there is a "random article" link on the left column of the first page. Once you get the random page, just generate a random number which will be the index where you start reading your "random text".
I like that, I had considered creating basic single line widths for using as fonts to minimize run time I'm having some issues with the Ethernet shield getting a useable SPI stream, so far I've just been modifying the example sketches, My knowledge of web interface is a big limitation I think, has anyone used one of the Ethernet shields for a similar purpose?
Check out the WebClient.ino sketch that comes with Arduino 1.0
It basically gives you access to the content of a web page as you would read from the serial port.
Scripts should use an informative User-Agent string with contact information, or they may be IP-blocked without notice.
disconnecting."
and here is the code Im using:
/*
Web client
This sketch connects to a website (http://www.google.com)
using an Arduino Wiznet Ethernet shield.
Circuit:
* Ethernet shield attached to pins 10, 11, 12, 13
created 18 Dec 2009
modified 9 Apr 2012
by David A. Mellis
*/
#include <SPI.h>
#include <Ethernet.h>
// Enter a MAC address for your controller below.
// Newer Ethernet shields have a MAC address printed on a sticker on the shield
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress server(91,198,174,225); // Google
// Initialize the Ethernet client library
// with the IP address and port of the server
// that you want to connect to (port 80 is default for HTTP):
EthernetClient client;
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
// start the Ethernet connection:
if (Ethernet.begin(mac) == 0) {
Serial.println("Failed to configure Ethernet using DHCP");
// no point in carrying on, so do nothing forevermore:
for(;;)
;
}
// give the Ethernet shield a second to initialize:
delay(1000);
Serial.println("connecting...");
// if you get a connection, report back via serial:
if (client.connect(server, 80)) {
Serial.println("connected");
// Make a HTTP request:
client.println("GET http://en.wikipedia.org/wiki/Special:Random HTTP/1.0");
client.println();
}
else {
// kf you didn't get a connection to the server:
Serial.println("connection failed");
}
}
void loop()
{
// if there are incoming bytes available
// from the server, read them and print them:
if (client.available()) {
char c = client.read();
Serial.print(c);
}
// if the server's disconnected, stop the client:
if (!client.connected()) {
Serial.println();
Serial.println("disconnecting.");
client.stop();
// do nothing forevermore:
for(;;)
;
}
}
From what I am gathering, it seems that your server should be "wikipedia.org" rather than "91,198,174,225" (google).
Then, when you output the GET request, you only specify the string after the domain name, like this: