Show Posts
Pages: 1 ... 10 11 [12] 13 14 15
166  Using Arduino / Project Guidance / voice counting 0 to 9 and some words without a shield. on: July 08, 2012, 06:57:22 pm
Well after all the blinking effects.
I wondered would it be possible to let a Arduino speak ?

I know the Duemilove has limited in memory for this, so i would first try only numbers 0 to 9 and some keywords.

Down sampling my wav i can get to a 92kb file.. still to much
Doubling the speed (should be played at 50% speed) gets it down half   46kb  (still to much)
Its a pcm mono unsigned 8000mhz 5.5 seconds fragment.
if i would only use the numbers its about 18kb .. but i like to use to extra key words.


One of the main problems to me
Is there a short routine to do frequency output ?
What would be i highest sound frequency ?
If i switch from frequency how fast can I switch (i suppose slower then the previous question) ?
 
>> thinking of letting a computer algorythm compress it to a simple ( frequency, duration )
>> and let a computer find some kind of best fit for it. (not sure yet how to)
>> it would be some kind of longterm project, just for fun to improve my programming skill

i've seen some sample from a guy who made a voicesynthesizer without a shield.
to be honestly i couldnt understand what was spoken, if sounds attempts surely result in something like that
then just advice me, that it is not do able.
167  Using Arduino / Programming Questions / Re: Let me share a c# sample string read from serial.println on: July 08, 2012, 02:19:58 pm
smiley

no, its not really flushing data, it was a way of speaking.
if you take a look at the code at this function :
private void serialPort1_DataReceived(object sender, System.IO.Ports.SerialDataReceivedEventArgs e)
       
you will find the difference of how each textbox gets its data.

---
End of packet marker, well i rather mind linebreaks, so i just reads whatever data is send and brings it back as the same string as was send by  serial.println its no problem if your strings are variable in size.
Also you wont need to install c# (but its a code demo) as a working executable is inside the zip too.
168  Using Arduino / Programming Questions / Let me share a c# sample string read from serial.println on: July 08, 2012, 09:33:57 am
Hello people here.

I improved upon a c# serial programming example, and i like to share it here.
This is a programming demo, and when started you will see options to connect.
Select your arduino comport, and select your baudrate, press start.

As for the demo, you will see two textboxes one on the left textbox1 and one on the right textbox2
When running the program will display the serial input from the arduino in both textboxes
The difference is, that the right textbox will only update on received whole line strings.
(serial.println)
It will not update on partial received data, if more then 1 line string is received it will also update per string.
In contrast the left textbox just flushes anything it receives including partial of strings.

Hmm fun but ehm why did i make it, you might wonder.
Well the point is, if you have a preformated string as output from your arduino.
And you would like to do something with it its much more easier, to work on the same string you tried to send. As compared to partial strings.

Imagine you would write in the arduino :
Serial.println("This is what i received.");
Serial.println("2678 do you like it?");

The left textbox1 might upate like :
---|This is wh|----|at i rec|----|eived. \r|----|\n 2|---|678 do y|---|ou like it? \r\n|  

However right textbox2 will update like :
---|This is what i received. \r\n|----|2678 do you like it ? \r\n|---

Practical..??
Well yes, if you know the syntax output from a GPS module or other data output it would be more easy to buildup on whole strings at a connected computer side, then parts of strings. I probably am not the first who solved it. But post it here so people who find this difficult to do com reading from c#, can use it.

Written in c# 2010 express  (free downloadable from Microsoft, just google it).


PS..
The code is as is, i'm not going to support it, or give long explanations about it, reason its working
But its a demo release and not a final version, as the final one wont include the leftbox, this version still does show the difference in programming, therefore you might learn from it. So instead of me explaining, i rather focus on a next version which will not be for a coding example, but will include some cool other stuff.



Just reply thanks if you liked it.
169  Using Arduino / Programming Questions / Re: Serial data read and write questions on: July 08, 2012, 08:17:48 am
Ok well here is my c# program, not yet translated it to arduino.
But the simple technique should be easily converted since commands are the same in c++ and c#
However capitalization differs, and some input/output formatting might differ. (linebreaks)
The whole simple trick is inside :
Code:
private void serialPort1_DataReceived(object sender, System.IO.Ports.SerialDataReceivedEventArgs e)

Its simple
It got two text boxes, as for demo purposes the left textbox1 just flushes anything that is received.

The right textbox2 works different, it only updates whenever a whole string is received.
If more then one Arduino whole serial.println string is received, it will add them each separate as whole strings. If there is no full string yet received but a partial one, it will not update the textbox2.


To be able to handle full strings could be handy since often you know the string syntax that gets out and you like to work on that string again, so that should be easier to do on the right textbox2


I compiled it to use .net 4.0  but one could recompile to use 3.0 too i think.
I used c# express 2010 which is a free download from Microsoft.
the c# project is attached to this post,

Please let me know what you think of it.
170  Using Arduino / Programming Questions / Re: Serial data read and write questions on: July 07, 2012, 06:33:25 pm
just as a side note.

I guess a lot of serial communication problems arise from dealing with buffers.
Both connected PC and Arduino can suffer from that; 
Under c# a comport.readline functions is kindoff problematic .
Well as of this night i just wrote a function that outputs whole line strings as output.
Which is kind of nice since often the serial.println string originated as a fixed format.
And so you often now the position of numbers etc
And so it nice to those real strings in return as sended by the arduino.

I'm now about to port this c# function to a c++ function.
To get the same kind of buffer solution if there is fast communication in the other direction.
I doubt if the arduino wouldnt be able to keep up, however its more of a programming exercise to me.
(i have to train c# and c++ urgently for getting a job), it might be handy for other devices connected to the arduino.

Well i was thinking maybe it could simplify your code such function in c++.


PS  If it is possible to upload code here on the site i would gladly upload the c# code



171  Using Arduino / Programming Questions / Waht are the largest programs for arduino used for ? on: July 07, 2012, 11:17:29 am
I am wondering what are the largest programs people made running on a arduino to control something ?
I've read about a chess program, but not the actual size of it.
If your making something huge please respond, or if you did that in the past, and write the compiled size of your project.
Do some people's project get near the 4K limit of the arduino, i am curious.
172  Using Arduino / Programming Questions / Re: Serial data read and write questions on: July 06, 2012, 08:19:31 pm
I'm wondered too, what the code should do
apparently he's doing a char like character read of the serial communication.
puts these chars in an array , on which a patern search occurs    ","DA   
and then he...pwow.. this matching complexity continuous..

Ehm not sure why he does it like this, has he tried to do a serial readln ?  (readline or isnt the device returning linebreaks in the output ?)
There are also other commands like  http://arduino.cc/en/Serial/ReadBytesUntil   (till next readout start?)
Which basically puts data in an array till a certain character, all at once.
But then you have the data is working with chars inside an array handy. (duh dough any string is an array ehm hmmm.)

If you know the delimeter character (line break or something else)
You might as wel use a string, add chars to it, until you have a match
the String object has many handy function to build up on more advanced string match functions.

I guess not many people read out the data the way you do, and i'm not exactly sure if it has a benefit to do so.

There are also some code samples delivered with the arduino software download, take a look at serial examples too.
173  Using Arduino / Programming Questions / Re: servo moving very slow,only works for delay of 1500 or more on: July 06, 2012, 06:34:45 am
ehm you do use Mosfets ?

well, a mosfet has 3 pins, lets suppose a pin is connected to 12V (V in) and another pin to your arduino to control the mosfet (gate), and another (V out)to your motors magnet from where it goes to ground.

The principle of the Mosfet is that a charge in the gate creates a tunnel inside the Mosfet so the magnet inside your motor gets power.

Mosfet however require little charge to control that tunnel, this gate charge is tiny compared to the their (V out) power. If you overwhelm it with a lot of charge, then it takes more time before the charge is gone (and you might even destroy the Mosfet if you give it to much on the gate).

If it takes more time to discharge then it means it doesnt switch off as fast as you like.

So that would result that inside a motor more magnets might still be turned on.

Resulting in weak motor performance, for both speed and torsion


To resolve use resistors on the gate (its also protective for the Mosfet)




174  Using Arduino / Programming Questions / Re: Setting up a block of space on: July 06, 2012, 06:17:03 am
not exactly sure what you want, why program in assembler ?
its possible dough but its often slow or developing software, update or remove bugs.
Never the less it is possible.

You might perhaps use a fixed array of char  (bytes).

Then read a little bit about pointers in C++ ( http://www.cplusplus.com/doc/tutorial/pointers/ )
A pointer will get you the offset of where the array is stored
Pointers can point to objects, functions, variables,...
Basically they point to the memory location

next you might take a dive into this   http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1207370768/2

I think before you start assembler, first try c++
It might sound cool to be able to do it (i one could write assembler for the MSX), but its not an easy road
It might require lots of time to learn, and you be able to create small things with it, the same investment in other programming languages leads programmes who can do more (but 'might' not be as fast as assembler, on the other hand these program languages do a good job of translating code to assembler too, so you can focus better on higher goals and achieve more with less code to invent yourself.
175  Community / Website and Forum / Link to a good c# example on: July 05, 2012, 08:23:09 pm
I've been trying to get windows form based serial reader working under C# for almost a week now.
The point is things in forms work a bit different then under 'dos' consoles.
And besides that some older code samples wont work under C# 2010 / 2008

i found this link http://csharp.simpleserial.com/
which (after one adjusts the com port) finally works


Could someone please add the link introduction page of C# and Arduino ?

So other people will wont struggle  like me, and spend way to much time to get it working (if ever).
Its kinda hard to do under C#, to do it right, since under C# its hard to do asynchronous events.
Especially if you just started C# (or even if used it for quite a while, its a very complex topic).
(reminder good c# is totally event driven). The code on that hyperlink is a very good.
No its an EXTREME good example of how it should be programmed.

Good samples are hard to find, i've seen samples who do things wrong or even override system routines
for what they think is better, it is not required this sample proves C# has no bugs for com communication.



176  Using Arduino / Programming Questions / Re: servo moving very slow,only works for delay of 1500 or more on: July 05, 2012, 04:02:41 pm
not sure if this is the case, but if you use mosfets to control your motor, there needs to be a resistor between the pinout and the mosfet control.
If you give a mosfet full power its inner fieldeffect doesnt do a good job of discharging resulting in less fast switching off turned on mosfets
resulting in previous cycle of magnets not powering off fast enough, and slow motor performance.
Like a transistor a mosfet only requires little power to drive their output

it seams to be an error that happens to a lot of people
177  Using Arduino / Programming Questions / Re: Editing .cpp and .h files on: July 05, 2012, 03:25:00 pm
maybe Editra  ? (editor)
178  Using Arduino / General Electronics / Re: is there a 24 volt version of arduino ? on: July 04, 2012, 02:45:04 pm
Well once Linux was for hobbyists too,
People bring and help with their different knowledge expertise and at some boiling point, there is a turn.
Suddenly a massive group of enthusiast role a dice against some commercial products. 
I have seen this so often in software, (and i think rep rap, is another hardware example for this)
I think those free spirits, often create products that commercial people dont feel a need to create.
As they rather like to protect their market.

(i see now 2 posts of 24volt arduino in this blog, so i think such tipping points are near)
179  Using Arduino / General Electronics / Re: is there a 24 volt version of arduino ? on: July 04, 2012, 06:39:26 am
hmm its kinda strange,
You see computers at industrial workfloors (who are way more sensitive)
Yet people put question marks at replacing arduino for a plc.
In the end i think it comes down to proper electronics and shielding; and that could be done with any good circuits i think.
Best would be decoupled circuits / optical / relays /etc..
But its not up to me to change industries, dough i would assume its do able.
And perhaps they will if they start to realize it.

smiley perhaps a nextgen project
180  Using Arduino / General Electronics / Re: is there a 24 volt version of arduino ? on: July 03, 2012, 05:23:20 pm
@Rob it sounds like you already used arduino with PLC combinations, what's your view on it ? do you prefer it or ... ?
Pages: 1 ... 10 11 [12] 13 14 15