Arduino based USB Pendant for Linuxcnc

More
14 years 4 days ago #25937 by ArcEye

Self-adhesive library film?
www.staples.co.uk/bts-offers/bts-office-...cover-film-45cm-x-1m

That looks like the best bet so far, you could actually wrap it under the keypad before sticking it down to the box lid and it should protect the whole thing.

Then it won't matter what paper and printing method you use, within reason

Please Log in or Create an account to join the conversation.

More
14 years 1 day ago #26143 by Miselph

ArcEye wrote: I did create many more pins and try to display much more system data originally, but found that the poor little arduino just could not cope.


Hi ArcEye,

I have to say that I am surprised by the limitations you have encountered. I have always found the arduino to be surprisingly powerful for what it is but sometimes the software libraries leave quite a bit to be desired.
What speed are you running the i2c bus at? The default is (or used to be) 100khz which is quite slow when you are trying to transfer any amount of data to the screen and could well account for much of the lag you have encountered. You can increase the bus speed to 400khz by changing a line in the Wire class (see this post )
The other thing I was wondering; I see that you are running the serial at 9600. Is there any reason this cannot be increased?

regards
The following user(s) said Thank You: ArcEye

Please Log in or Create an account to join the conversation.

More
14 years 12 hours ago #26178 by ArcEye
Hi

Miselph wrote: You can increase the bus speed to 400khz by changing a line in the Wire class (see this post )


Thats interesting, thanks I will try that when I get the chance.

The other thing I was wondering; I see that you are running the serial at 9600. Is there any reason this cannot be increased?


In theory yes, but I had read a lot of reports of problems using the SoftwareSerial libraries above 9600.

I have not tried increasing the BAUD rate, because it wasn't the delivery of the packets that caused problems rather the display of the info therein.
If the i2c bus speed change has a dramatic effect, that could be worth doing

regards

Please Log in or Create an account to join the conversation.

More
14 years 11 hours ago #26181 by andypugh

ArcEye wrote: In theory yes, but I had read a lot of reports of problems using the SoftwareSerial libraries above 9600.


I am running serial at 1Mb out of my Arduino into a Mesa soft-UART,

Please Log in or Create an account to join the conversation.

More
13 years 11 months ago #26312 by Miselph
Hi All,

Just thought I would share the progress of my Arduino based pendant.



At the moment it lives on a breadboard, pending the construction of the required PCB. I am using an Arduino Nano as it has everything I need, including FTDI usb to serial chip and is very small.
I was not happy with the amount of time that the standard Keypad library took, so I wrote my own that uses direct port manipulation rather than digitalRead and digitalWrite and I reduced the scan time from 430us to 20 us. Unfortunately this used the majority of my pins, so the LCD has been attached on the SPI bus, clocking the bits out at 8MHz to a 74HC595 shift register; a full update of the screen takes 14ms. The purpose of these speedups is to leave more runtime available for serial processing. The keypad is scanned every 10ms using a timer based interrupt so as to ensure that I don't miss any key strokes and keystrokes entered into a buffer. Another feature I have added to my Keypad library is the ability to return the keypad status as two bytes, with each key represented by 1 bit. This reduces the amount of data that has to be transferred to two bytes, regardless of how many keys are active. Keys can also be set up as either momentary or toggle.
I have also begun work on a serial packet-based protocol for reliable communication of different data types. So far I can send integers and strings with no problem. The reason for this is that I am intending to use wireless which is especially prone to data loss so I need a protocol with error checking and rejection in it; we don't want the machine doing strange things due to corrupted data now do we? It would be a good idea to adopt such a protocol regardless of connection type, as any connection will suffer some data loss from time to time.

More information as I progress.....

Chris

Please Log in or Create an account to join the conversation.

More
13 years 11 months ago #26528 by VNR

I have also begun work on a serial packet-based protocol for reliable communication of different data types. So far I can send integers and strings with no problem. The reason for this is that I am intending to use wireless which is especially prone to data loss so I need a protocol with error checking and rejection in it; we don't want the machine doing strange things due to corrupted data now do we? It would be a good idea to adopt such a protocol regardless of connection type, as any connection will suffer some data loss from time to time.

I have succesfully connected an arduino to HAL using modbus protocol wich have CRC packet verification. May be you want to test it.
I don't have tested it with wireless, so i don't know if it will work in this case, but now it is working for me with an Arduino Mega 2560 R3 board, a Modbusino library (modbus) and a USB cable at 115200 bps.
The source code is here: sourceforge.net/tracker/?func=detail&aid..._id=6744&atid=356744
The protocol transfers integers and bits in 2 ways by default, but you could packet a float into 2 integers and a string into an array of integers if you need them.
Regads,
Victor

Please Log in or Create an account to join the conversation.

Time to create page: 0.334 seconds
Powered by Kunena Forum