Nowadays, there are many software to simulate Arduino or electronic projects, but today I am going to show a really easy one. Tinkercad is an online simulation software develop by Autodesk, because it is online, you don´t have to install anything on your device. It has a lot of components and it is totally free, you have to register and then you are ready to begin your simulation projects. Another think that you can do on Tinkercad, is to design 3D objects, I haven´t used yet, but I think it is really a basic program like the new 3D paint on windows.
Features:
- Collaborative projects
- Online and free
- You can share projects with the community
- Easy to use
- On cloud storage
- Interactive
- Code by text or blocks
Now I am going to show you a little example, so you can know the basics.
Controlling a servo with a digital PIN on Arduino
In this example we are going to control a servomotor by using a digital pin on an Arduino board, we are basically to simulate a PWM signal changing states of a digital pin.
In the next image your going to see how a servo can move through different positions just changing the width of the HIGH state on a PWM signal frequency.
First, enter to Tinkercad website and register, once you are registered and have logged in, go to circuit on the main page and create a new Circuit.
Go to the right side and searh for a microverso, a pot and an Arduino board. Like in the image below.
Connect both components:
Servo Arduino
Red 5 v
Black GND
Orange pin 9
POT
Center A0
Left 5 v
Rigth GND
To code our Arduino, we are going to click on the Code button and then click on Text. An IDE window will appear, we are going to put the next code, it is commented, so you can understand it.
//Define pins and variables
#define servo 9
int pot;
void setup()
{
//Setting up the Serial port, so we can see our variable velues
Serial.begin(9600);
//The pin to control our servo as OUTPUT
pinMode(servo, OUTPUT);
}
void loop()
{
//Using the pot to change our pulse width on HIGH state
pot= map(analogRead(A0), 0, 1023, 700, 2000);
//Showing the actual value
Serial.println(pot);
//Making out PWM pulse, changing from HIGH to LOW for specific periods digitalWrite(servo, HIGH);
delayMicroseconds(pot);
digitalWrite(servo, LOW);
delayMicroseconds(1500-pot);
}
Once you have your code and all setting up, start the simulation. You will see how the servo is moving while you change the value on the potentiometer. Like in the next animation.
This is all, hope you like it and find this information useful.
Congratulations @techvlogs! You have completed the following achievement on Steemit and have been rewarded with new badge(s) :
Award for the number of upvotes
Click on the badge to view your Board of Honor.
If you no longer want to receive notifications, reply to this comment with the word
STOP
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Congratulations @techvlogs! You received a personal award!
You can view your badges on your Steem Board and compare to others on the Steem Ranking
Do not miss the last post from @steemitboard:
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit