Recent Posts

Pages: 1 2 3 ... 10
Software / Re: MIDI Conrolled Animatronic project
« Last post by Doug83 on Yesterday at 01:34:54 PM »
I'm not sure what you mean by "saving wav files with PWM data".
(-and I thought a MIDI source would only send MIDI files? but anyway-)

There is already a lot of guides online that allow you to connect an Arduino to a MIDI output, and then have the arduino control LEDs in response to MIDI signals fed to the Arduino.
So you could just use plain MIDI files to do it.
Software / MIDI Conrolled Animatronic project
« Last post by artistinfla on Yesterday at 10:52:58 AM »
I am planning on using a 16 track MIDI controller to save and send wave files with PWM data which can be converted and sent to a PWM amplifier to drive the servos. 

Can I save PWM data on a wave file?

I was reading that I could use Audacity with the PWM plugin to generate these files.  I am not well-versed in WAV files and could use some help.  Having the midi controller would allow me to sync movement to music and sound.

Has anyone done this or know how it could be done. 

I have 11 servos to control.

Misc / Re: WHAT IS A SERVO????????
« Last post by digibloke12 on August 18, 2017, 05:46:21 AM »
I'm new, too, and when I was just starting, I saw Power Motion: An Introduction to Servo Motors and barely understood something.

To cut to the chase, I did a little bit of research after that, and based on what I was able to understand one of the references (Wikipedia), Servomotors are an automatic device which reacts on negative feedback? Hope my understanding served me right. Well, I've got a long way to go!   ;D
Software / Re: Dweeno Link: Visual Basic robot control
« Last post by Doug83 on August 17, 2017, 10:18:33 PM »
Before moving on to other more complicated things, I will add a couple more little features to what is done so far.

1. Add a combobox control to allow changing the connection speed.
2. Add a checkbox control to allow or prevent the [Send button] from disabling automatically until a response is received.

See the image below:

Drag the form's border and the two groupboxes out so you have more room, and arrange the existing controls like you see above.

1) Drag a new Label from the Toolbox onto the form, and change its Text property value to say Speed . Leave its Name as it is.

2) Drag a ComboBox from the Toolbox onto the form. Leave its Name as it is (ComboBox1). Change the DropDownStyle property to DropDownList.

3) Now, drag a CheckBox control onto the form, below the [Send button]. Change the Text property to say ?Keep send button enabled?. Leave its name as it is (CheckBox1).

Now you need to add some code, so switch to the code-view tab.

Near the top, there is a subroutine that begins with this line:
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

Create a new line inside that sub and add the lines below:
Code: [Select]
ComboBox1.SelectedIndex = 0

Next, go back to the designer tab and double-click on the Listbox1 control. It will switch back to the code-view tab and put the cursor inside the sub that begins with the line:
Private Sub ListBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ListBox1.SelectedIndexChanged

In that sub there is a line that says MySerialPort.Open() .
Make an empty line ABOVE that statement, and then add the line below:
Code: [Select]
MySerialPort.BaudRate = Convert.ToInt32(ComboBox1.SelectedItem.ToString)

Next, go back to the form design tab, and double-click on the checkbox you made earlier.
Visual Studio will create a subroutine as below, but without any lines inside it (just the first and last lines).
You need to copy all inside lines below, and put them into your own sub.

Code: [Select]
Private Sub CheckBox1_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox1.CheckedChanged
        If ListBox1.SelectedIndex <> -1 Then
            If CheckBox1.CheckState = CheckState.Checked Then
                Send_Button.Enabled = True
            End If
        End If
    End Sub

Next, go back to the form design tab again, and double-click on the [Send button].
Visual Studio will switch to the code view tab and put the cursor into the sub for that button.
You need to change your code so that it looks like what is below.

Code: [Select]
Private Sub Send_Button_Click(sender As Object, e As EventArgs) Handles Send_Button.Click
        If MySerialPort.IsOpen() Then
            incomingData = ""
            outgoingData = Sending_TextBox.Text
            'If you wanted the ability to automatically progress through a list of commands,
            'then this is where you would start the process by sending the first command in the list of commands to send.
            Receiving_TextBox.Text = ""
            If CheckBox1.CheckState = CheckState.Unchecked Then
                Send_Button.Enabled = False
            End If
        End If
    End Sub

NOW,,,, if there is no errors, try to build/run the program again.

The connection speed combobox will default to the highest speed of 115200, but now you should be able to set it to slower speeds if you want.
The speed change does not take effect until you click into the listbox below however, on the COM port you want to use.

If you check the "Keep send button enabled" checkbox, then the Send button won't be disabled while waiting for an Arduino response.
And if the Send button is already disabled, checking the checkbox should re-enable it again--even if it was disabled because the PC was already waiting for an Arduino reponse.
Misc / Motor for spinning wheel
« Last post by singerep on August 17, 2017, 01:49:06 PM »
Hello! Can anyone recommend a inexpensive motor to be used to continually spin a medium-lightweight wheel about 6 inches in diameter at at least 4000 rpm (preferably more).
Robot Videos / Robotic walking aid for the cisually impaired feedback
« Last post by Captain Awesome on August 16, 2017, 01:53:34 PM »
I built this for a school project and need feedback on how the robot looks, works snd just in general. Can you please help me?
Software / Re: Dweeno Link: Visual Basic robot control
« Last post by Doug83 on August 16, 2017, 01:09:27 PM »
If you run the program from within the Visual Studio program, then what you are really doing is running the source code files inside the Visual Studio debugger. It should work like that, but running the executable file will often work a bit faster and most people probably don't want to open Visual Studio every time just to use the Dweeno Link program anyway.

To get to the executable file, find the project folder that the project was saved into.
For Visual Studio it will be in your Documents folder in [Visual Studio 2017]--[Projects]--[(project name)]--[(project name)]--[bin]--[Debug]
The file has the project filename, and the .exe extension.
If you edited a project that you began in a previous version of Visual Studio, then it will be in the same place, but in the folder for that Visual Studio version instead (such as [Visual Studio 2016] or [Visual Studio 2015]).

When you run the program in the debugger it may work fine and not show any errors, but when you run the executable, the operating system may stop and say it has various errors.
This isn't greatly unusual.
Debuggers don't catch everything; Visual Studio works pretty well but debuggers are programs themselves, and they have bugs too.
The operating system will often catch run-time technical errors that the IDE ignored or missed.

Lastly: if you attempt to run this executable on another computer that does not have Visual Studio installed and it will not run, then you may need to also install a .NET Framework redistributable package from Microsoft. This was the case in past years but MS may have just included it into the normal Windows Updates nowadays.


At this point I'm going to wait a few days and see if anyone tries this, and if they have any problems.

The automatic control part can be added on to the Dweeno Link program with the existing controls in place.
I haven't done that yet myself, but it isn't difficult.
Software / Re: Dweeno Link: Visual Basic robot control
« Last post by Doug83 on August 16, 2017, 12:57:36 PM »
Okay, so your Dweeno Slave program has no errors and runs now.
Here is the instructions for how to use it.

1) Start the Dweeno Link program again, in the debugger (-for now).
2) Click the upper-left button that says ?Refresh serial ports?. This will cause all the available serial ports to be listed in the textbox immediately below.

Note: you may prefer to disconnect your Arduino when first pressing the ?Refresh serial ports? button, and then connect the Arduino and wait a couple seconds for it to be recognized, and then press the ?Refresh serial ports? button again. The new COM port will probably be the one that the Arduino is using.
-you can just try sending Arduino messages to all the COM ports that show up.
I don't know for a fact that it is safe to do, or that it might harm anything.
I've tried it with my PC and nothing bad seemed to happen, but you are acting on your own there.

3) Then in the listbox, you click on the COM port that you want to use (the one that the Arduino is connected to). That same COM port will then appear in the textbox below, titled ?Selected port:?. This means that the selected COM port is the one that the SerialPortObject in the Dweeno Link program is set to use.

Sometimes when starting the PC program you also have to hit the [reset] button on the Arduino. I have not been able to pin down why this happens yet.

4) When you start Dweeno Link, the [Send Button] starts out disabled because there's no serial port set to send on. When you clicked into the listbox on a COM port, that also should have enabled the [Send Button]. Type your command in the ?Data to send? textbox, and press the [Send Button]. The [Send button] will turn gray, as it is disabled until a response from the Arduino comes.

5) If something goes wrong and you want to re-enable the Send button, then just click again on the selected COM port in the Listbox. That will enable the Send button again.

What commands you can send are shown below.

The blink-slow command:
 --- where 7 is the number of times you want it to blink. Blink time is 1 second on, 1 second off.
It will send the following message when it is finished:

The blink-fast command:
------where 25 is the number of times you want it to blink. Blink time is on-off, four times per second.
It will send the following message when it is finished:

To read the digital value of pin 3:
and it answers with the reply:
------where X is the value of the #3 pin, either zero or 1.

To read the analog value of pin A3:
and it answers with the reply:
------where X is the value of the pin, an integer from zero to 1023.

,,,,Of course, if you got nothing connected to either of those pins, then the result you will get is random.
But you could hook something suitable onto them to test, if you wanted to.

To digitalWrite to pin 4:
------where X is either zero or 1, that you want the pin set to.
and it answers with the reply:
------to confirm that it has completed setting the pin.

To analogWrite (PWM) to pin 5:
------where X is a number from zero to 255.
and it answers with the reply:
------to confirm that it has completed setting the pin.

,,,for the pin-writing commands, you could connect a LED and a 200 ohm resistor to show the pin's states.

arduinoTimeDelay(int t_Minutes, int t_Seconds)] ----- This function causes a time delay.
------where X is the time in minutes to wait.
------Y is the time in seconds to wait.
The total time ends up being (minutes * 60) + seconds.
After the specified time interval has passed, the Arduino replies:

More info about the arduinoTimeDelay() function:
When a lot of people start using Visual Basic, they ask if there is a way to make it slow down or pause while doing something. There are different ways to do that, but--just like the Arduino's delay() function--the simplest and easiest ways have some serious drawbacks overall and are hardly ever used in the professional world.

This function allows the PC to pause sending more commands, by telling Arduino to pause instead. And the way that this function is written, it doesn't use the delay() function at all, so it does not interfere with any other tasks that the Arduino is supposed to be doing at the same time. For example: if you press one of the Arduino buttons when a the arduinoTimeDelay() function is running, the Arduino will still send the button message back to the PC.

Also there is the buttons:

Any time that button #1 is pressed, the Arduino will send the following message:

Any time that button #2 is pressed, the Arduino will send the following message:

Neither of the button commands can be called from the PC, they can only originate from the Arduino.
Both buttons share a one-second de-bounce timer. If you press either button, neither will work until 1 second of time has passed.

There is also a general error message.
If a function number that was sent cannot be matched with a function in the Arduino's sketch, then the commandNotFound() function is called and sends back the following message:
You can verify that this works by entering a non-existent command, such as 999:*

This is the same list of commands given a couple posts above. Oh well.
Also a lot of my quotes changed to question marks. --So if you see question marks, those maybe are supposed to be quotes.

So now you may begin to see how this code can be modified into an automatic controller for the Arduino.
It doesn't do that right now, but it has the basic event handling in place to do that.
There is even some comments in the Visual Basic code, hinting where things need to be added.

All you need to add at this point is a way to store a list of desired Arduino commands, and then every time the [Send command] button gets re-enabled, that means you can process any data sent back from the Arduino and then send the next Arduino command.
Software / Re: Dweeno Link: Visual Basic robot control
« Last post by Doug83 on August 16, 2017, 12:53:42 PM »
Now we need to put in the code to make the form work.
To do that, we need to get to the coding view of Form1.
The easy way to do that is to double-click on the title bar of the Form1 window in the designer view currently open.

Another tab will open, showing the same form but in its coding view.

It will look basically like this:

Code: [Select]
Public Class Form1

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    End Sub

End Class

There is another pastebin link below.
Everything in that pastebin paste, you must copy and past *over* everything that is currently on that tab page.

Save the project, and check that there are no errors indicated (there should be no underlined code, or anything showing on the warnings list or error list).

If there is no errors or warnings, then you can run the program.
If the program needs to be rebuilt, Visual Studio will do that automatically.

In one of the toolbars along the top, there is a [Start] button with a green triangle pointing right; that will build the program and then start the program running in the debugger.

Alternately, go to the menu bar and click on [Debug], and then click on the [Start Debugging] option.

Either way, the program should pop up running in a few moments. It can take 30+ seconds to finish building the first time.

The Dweeno Link program window should pop up, on top of the Visual Studio window.
Visual Studio also starts up some performance-monitoring stuff at the same time--little moving charts to show memory usage and so on.

You can stop the Dweeno Link program by either clicking on it's own [close] button in the top-right corner, or by clicking on the [Start] button again in Visual Studio, which will have now changed to a [Stop] button with a red square on it.
Software / Re: Dweeno Link: Visual Basic robot control
« Last post by Doug83 on August 16, 2017, 12:47:28 PM »
Next we will create the controls needed.
The picture below (04_form_layout) shows what I made mine look like. You want it to look like this but the exact sizing of anything isn't critical.

Below is the steps to create and name these things properly.
Some of them must be renamed because you will copy & paste the page code in, and your control names must match what is in the pasted code.

Whenever you highlight an object, the Properties window changes to show the Properties of that object, and you can change the individual property settings.

1) Click on the blank form and then in the Properties window, find the property in the left column named Text. To the right it will say Form1. This is the text that will appear in the Window's title bar. You don't NEED to change it, but I changed mine to say Dweeno Link 2017 v1.0. Edit it if you want and hit the [enter] key or mouse-click into any other property value, and the changes will appear on the Form1 [Design] tab. Note that this ONLY changes the window's title bar text; it doesn't change anything else about the program or project.

Non-numbered step: click on the blank form and then click down on the lower-right corner, and drag it down and right to make the form area bigger. This is just to make it easier to place controls on, you can make it smaller again later.

To add controls onto the form in a particular place, you drag the control you want from the Toolbox and then drop it on the form where you want it.

2) Find the GroupBox control (in the Containers sub-section) and drag it onto the form. With the GroupBox still highlighted, go to the property that says Text and change its value to Select port. Arrange this on the left side of the form. You don't need to change the name.

3) Drag another GroupBox onto the right side of the form. Change the Text property of this one to say Serial connection.  You don't need to change the name.

Note: GroupBoxes usually don't really do anything, they are just a way to group related controls visually.

4) Drag and drop the Button tool from the toolbox into the left Select port groupbox. Change the button's Name property to RSP_Button , and then change the button's Text property to Refresh serial ports.

5) Drag and drop the ListBox tool into the left Select Port groupbox, under the button. The ListBox Name property should be ListBox1 and you should leave it as that. Check that the SelectionMode property says One.

6) Drag and drop the Label tool into the left Select Port groupbox. Change the Label's Text property to Selected port: . The Label's name does not need to be changed.

7) In the Toolbox, find the TextBox tool and drag it into the left Select Port groupbox. Change its Name property to SelectedPort_TextBox , and set its ReadOnly property to True.

8) Drag and drop another Label into the right Serial connection groupbox. Change its Text property to Data to send: . The label's name does not need to be changed.

9) Drag and drop another TextBox below the label you just made in the right Serial connection groupbox. Change the textbox's Name property to Sending_TextBox .

10) Drag another Button onto the form, and drop it in the right Serial connection groupbox. Change its Name property to Send_Button , and change its Text property to Send button .

11) Drag and drop another Label into the right Serial connection groupbox. Change its Text property to Data received: . The Label's name does not need to be changed.

12) Drag and drop another TextBox into the right Serial connection groupbox. Change its Name property to Receiving_TextBox , and set its ReadOnly property to True.

Whenever you click on a control, its drag handles appear and you can use them to resize the control.
It may be helpful to drag the Form1 and the groupboxes out bigger to get all the controls in, and then reduce them afterwards.
Drag them around until you get something similar to what I showed in the first image above.
Pages: 1 2 3 ... 10

Get Your Ad Here