simple robot suing asp.net and arduino.
#includecircuit diagram :char val; // Data received from the serial port int motorPin1 =2; int motorPin2 =3; int motorPin3 =4; int motorPin4 =5; int addr = 0; // start reading from the first byte (address 0) of the EEPROM int address = 0; byte value; void setup() { pinMode(motorPin1, OUTPUT); // Set pin as OUTPUT pinMode(motorPin2, OUTPUT); // Set pin as OUTPUT pinMode(motorPin3, OUTPUT); // Set pin as OUTPUT pinMode(motorPin4, OUTPUT); // Set pin as OUTPUT Serial.begin(9600); // Start serial communication at 9600 bps } void loop() { if (Serial.available()) { // If data is available to read, val = Serial.read(); // read it and store it in val } if (val == 'L') { // If L was received digitalWrite(motorPin1, LOW); digitalWrite(motorPin2, HIGH); digitalWrite(motorPin3, HIGH); digitalWrite(motorPin4, LOW); EEPROM.write(addr, 11); // advance to the next address. there are 512 bytes in // the EEPROM, so go back to 0 when we hit 512. addr = addr + 1; if (addr == 512) addr = 0; delay(50); } if (val == 'R') { // If R was received digitalWrite(motorPin1, HIGH); digitalWrite(motorPin2, LOW); digitalWrite(motorPin3, LOW); digitalWrite(motorPin4, HIGH); EEPROM.write(addr, 10); // advance to the next address. there are 512 bytes in // the EEPROM, so go back to 0 when we hit 512. addr = addr + 1; if (addr == 512) addr = 0; delay(50); } if (val == 'B') { // If B was received digitalWrite(motorPin1, LOW); digitalWrite(motorPin2, HIGH); digitalWrite(motorPin3, LOW); digitalWrite(motorPin4, HIGH); EEPROM.write(addr, 01); // advance to the next address. there are 512 bytes in // the EEPROM, so go back to 0 when we hit 512. addr = addr + 1; if (addr == 512) addr = 0; delay(50); } if (val == 'F') { // If F was received digitalWrite(motorPin1, HIGH); digitalWrite(motorPin2, LOW); digitalWrite(motorPin3, HIGH); digitalWrite(motorPin4, LOW); EEPROM.write(addr, 00); // advance to the next address. there are 512 bytes in // the EEPROM, so go back to 0 when we hit 512. addr = addr + 1; if (addr == 512) addr = 0; delay(50); } if (val == 'S') { // If F was received digitalWrite(motorPin1, LOW); digitalWrite(motorPin2, LOW); digitalWrite(motorPin3, LOW); digitalWrite(motorPin4, LOW); EEPROM.write(addr, 100); // advance to the next address. there are 512 bytes in // the EEPROM, so go back to 0 when we hit 512. addr = addr + 1; if (addr == 512) addr = 0; } if( val == 'R') { value = EEPROM.read(address); if (value == 00)//fwrd { digitalWrite(motorPin1, HIGH); digitalWrite(motorPin2, LOW); digitalWrite(motorPin3, HIGH); digitalWrite(motorPin4, LOW); delay(50); } if (value == 01)//bckwrd { digitalWrite(motorPin1, LOW); digitalWrite(motorPin2, HIGH); digitalWrite(motorPin3, LOW); digitalWrite(motorPin4, HIGH); delay(50); } if (value == 10)//right { digitalWrite(motorPin1, HIGH); digitalWrite(motorPin2, LOW); digitalWrite(motorPin3, LOW); digitalWrite(motorPin4, HIGH); delay(50); } if (value == 11)//left { digitalWrite(motorPin1, LOW); digitalWrite(motorPin2, HIGH); digitalWrite(motorPin3, HIGH); digitalWrite(motorPin4, LOW); delay(50); } if (value == 100)// stop { digitalWrite(motorPin1, LOW); digitalWrite(motorPin2, LOW); digitalWrite(motorPin3, LOW); digitalWrite(motorPin4, LOW); } address = address + 1; // there are only 512 bytes of EEPROM, from 0 to 511, so if we're // on address 512, wrap around to address 0 if (address == 512) address = 0; delay(500); } }
![[IMG]](proxy.php?image=http%3A%2F%2Fi54.tinypic.com%2Fzv1z7p.png&hash=bf631aceb0021a8220aa089c5c44603b)
pcb :
![[IMG]](proxy.php?image=http%3A%2F%2Fi53.tinypic.com%2F2i9saog.jpg&hash=0f7d38f55ec4e7f39636df0a5283ae21)
browser window:
![[IMG]](proxy.php?image=http%3A%2F%2Fi55.tinypic.com%2F2imaxe8.jpg&hash=65e64f09d85b6ce552e1ce2c5aec8e4a)
/////////////////<3<3<3//////////////////
Replies
-
magnatronps the compiler program used is arduino
-
Rupam DasHello. I have Few doubts.
That is the program that you burn in adruino. Right?
How are you interfacing adruino with PC? Are you using USB or Parallel port.
Could you share with us the block diagram and ASP.Net program that communicates with Adruino? -
magnatron
yeah.. actually its burnt into the AVR MCU i.e atmega xx its serial communication (UART), its just uses the inbuilt fuction for eg:Rupam DasHello. I have Few doubts.
That is the program that you burn in adruino. Right?
How are you interfacing adruino with PC? Are you using USB or Parallel port.
Could you share with us the block diagram and ASP.Net program that communicates with Adruino?
Imports System.IO.Ports Partial Class Control Inherits System.Web.UI.Page Dim WithEvents serialPort1 As SerialPort Dim myString As String = "" Dim por As String Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click Try Label1.Text = "Portselected " & TextBox1.Text & " do not change the text(COM#) in textbox" serialPort1 = New System.IO.Ports.SerialPort(TextBox1.Text, 4800, Parity.None, 8, StopBits.One) serialPort1.Open() myString = "S" serialPort1.Write(myString) serialPort1.Close() Catch ex As Exception Label1.Text = ex.Message End Try End Sub Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click Try Label1.Text = "Portselected " & TextBox1.Text & " do not change the text(COM#) in textbox" serialPort1 = New System.IO.Ports.SerialPort(TextBox1.Text, 4800, Parity.None, 8, StopBits.One) serialPort1.Open() myString = "F" serialPort1.Write(myString) serialPort1.Close() Catch ex As Exception Label1.Text = ex.Message End Try End Sub Protected Sub Button3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button3.Click Try Label1.Text = "Portselected " & TextBox1.Text & " do not change the text(COM#) in textbox" serialPort1 = New System.IO.Ports.SerialPort(TextBox1.Text, 4800, Parity.None, 8, StopBits.One) serialPort1.Open() myString = "B" serialPort1.Write(myString) serialPort1.Close() Catch ex As Exception Label1.Text = ex.Message End Try End Sub Protected Sub Button4_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button4.Click Try Label1.Text = "Portselected " & TextBox1.Text & " do not change the text(COM#) in textbox" serialPort1 = New System.IO.Ports.SerialPort(TextBox1.Text, 4800, Parity.None, 8, StopBits.One) serialPort1.Open() myString = "R" serialPort1.Write(myString) serialPort1.Close() Catch ex As Exception Label1.Text = ex.Message End Try End Sub Protected Sub Button5_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button5.Click Try Label1.Text = "Portselected " & TextBox1.Text & " do not change the text(COM#) in textbox" serialPort1 = New System.IO.Ports.SerialPort(TextBox1.Text, 4800, Parity.None, 8, StopBits.One) serialPort1.Open() myString = "L" serialPort1.Write(myString) serialPort1.Close() Catch ex As Exception Label1.Text = ex.Message End Try End Sub Protected Sub Button6_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button6.Click por = TextBox1.Text Label1.Text = "Portset " & por & "do not change the text(COM#) in textbox" End Sub Protected Sub TextBox1_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged End Sub End Class
-
Rupam DasThis is cool Stuff. Great work Dude. I am on my way. Putting it in Adruino and will convert it to C#, I am gonna replace ASP.Net with C#.net windows application. Will Interface Bluettoh and will post the video in CE in a week.
-
Rupam DasAND megatron, You are rocking. You are that gem of the source that we were missing that badly. Super work and keep posting. You are gonna make many fans in CE. I am your first one.
-
magnatron
do you have the Bluetooth shield of arduino? then its best ( i used a 433 MHz transmitter/receiver module) . the program is in vb (easier for me lol). try to make the interface first and just paste the code and compile.Rupam DasThis is cool Stuff. Great work Dude. I am on my way. Putting it in Adruino and will convert it to C#, I am gonna replace ASP.Net with C#.net windows application. Will Interface Bluettoh and will post the video in CE in a week. -
magnatron
thanks! rupam! but i did'nt see any likes for my post (LOL just kidding)Rupam DasAND megatron, You are rocking. You are that gem of the source that we were missing that badly. Super work and keep posting. You are gonna make many fans in CE. I am your first one.
PS: its magnatron.. 😉 I will keep posting (majorly in lab section) i am a big dumb in theory😐 . -
Rupam DasWeb Server(Code)------------>Connected With robot
|
|
|
|
|
Command Given Through Web Page
In that way, the robot is connected with Server. Physically considering that My Site is hosted remotely I would not be able to achieve It. Here is my Version
Web Sever ( Web Service)------------------->Another Browser Connected with Robot Fetching the command and controlling
|
|
|
|
|
Web page calling the web service and putting the command -
Rupam DasLibrary Robot
[video=youtube;Smx15eOFHXQ]https://www.youtube.com/watch?v=Smx15eOFHXQ[/video]
You might also be interested in this Video. LOL:: -
magnatronyeah, its done like that, but instead of publishing the web-service (for testing) what i did is to directly access the serial port of the computer. forgot to mention 😔
-
magnatronRe: Library Robot
good video simple circuits (check out the counter using the black thingies LOL)
You are reading an archived discussion.
Related Posts
/*////////////////////////////////////
//////////Magnatron/////////////////
////////////////////////////////////
////magnatronelectronics@gmail.com//
////////////////////////////////////
////////////////////////////////////
*/
int val = 0; // variable to store the data from the serial port
int serbyte = 0;
int rlyPin1 = 13;
int...
hey guys... i am not new to forms but new to this form... :O
:bighug::bighug::bighug:
Hi i am 3rd year electronic and communication engg. I like to undergo some mini project . But i have no idea. Wat can i do?...
I looking for person who will do some project in Matlab.
I need to project some electronic device, will be install between ECU and few sensors.
Device should:
- analyse...
Hi I am studying mechanical design and I have a few questions.
What is the difference between a single-stage and a double-stage gearbox?
How do you determine the number of...