Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : USB serial
Author | Message | ||||
Dave Everett Regular Member Joined: 24/06/2011 Location: AustraliaPosts: 43 |
Guys, If I have simply missed this in the documentation feel free to blast me. I understand that programs can be sent via USB. What I would like to do is use the Maximite as a USB peripheral, so Ican send commands to a running program on the maximite, to control external devices and read back sensor data. Is it as simple as running a terminal program? Thanks, Dave |
||||
rhamer Senior Member Joined: 06/06/2011 Location: AustraliaPosts: 174 |
It will be when serial comms arrives. Regards Rohan Rohan Hamer HAMFIELD Software & Hardware Solutions Makers of the Maximite Expander. http://www.hamfield.com.au |
||||
vasi Guru Joined: 23/03/2007 Location: RomaniaPosts: 1697 |
The USB CDC is used as serial interface connected to the basic interpreter. It can only upload or download basic programs. SO it can't be used to sent via USB the values of the read sensors. But it is a normal behavior because Maximite IS a standalone computer. It can read sensors and can store data on SD-Card. It is also capable to display data on your vga monitor in almost any form you want. If you need complex representations and analysis, then just take the SD-Card and insert it in a SD Card reader of a real PC. Regarding to reading sensors and actuators, I see more useful an interface via serial port with a 5V microcontroller board, keeping Maximite as a host and a data center. But as I understood, the serial UART rutines are not yet included in the firmware. Hope I am right... Vasi Hobbit name: Togo Toadfoot of Frogmorton Elvish name: Mablung Miriel Beyound Arduino Lang |
||||
Dave Everett Regular Member Joined: 24/06/2011 Location: AustraliaPosts: 43 |
As always, the best way to find something is to ask on a forum, then you will immediately find the info you're looking for in the manual :) I found this on the Maximite website: The USB socket is for connection to a desktop computer. The Maximite appears as a virtual serial port to the bigger computer and anything typed onto this port will be used by the Maximite just as if it has been typed on the keyboard. Similarly, any output from the Maximite will be sent to both the video and USB outputs. So I could send commands as keypresses through USB, and read data as if it were printed to the screen. That would solve my serial control problems. I need to investigate. Thanks all, Dave |
||||
vasi Guru Joined: 23/03/2007 Location: RomaniaPosts: 1697 |
Yes, as a direct response to your computer commands. But then, who is responsible with the logic program? Your PC application and not the Maximite which will indeed react at the command of your PC application. It is possible but a waste of a powerful 32bit microcontroller in my opinion. Hobbit name: Togo Toadfoot of Frogmorton Elvish name: Mablung Miriel Beyound Arduino Lang |
||||
vasi Guru Joined: 23/03/2007 Location: RomaniaPosts: 1697 |
I'm thinking that this can generate speed issues, specially on complex applications. Hobbit name: Togo Toadfoot of Frogmorton Elvish name: Mablung Miriel Beyound Arduino Lang |
||||
stuarts Senior Member Joined: 15/06/2011 Location: AustraliaPosts: 199 |
There is no reason why you cant have a program running on your PC that communicates with a running program on the Maximite. If the program on the Maximite is written to accept commands or data from the PC and return data, its no different to you running a program using a terminal emulator and issuing commands or answering prompts from the Maximite program. I think the real issue is writing the program on the PC that will be the communications conduit between the PC and the Maximite. I'm seriously thinking about writing a program on the Maximite to interface to a number of weather sensors and having a program running on the PC to either just accept serial data via the USB port from the Maximite, or set up a protocol where the PC can issue requests for data to the Maximite and receive the responses from the Maximite. Stuart Time is nature's way of keeping everything from happening all at once. |
||||
Ray B Senior Member Joined: 16/02/2007 Location: AustraliaPosts: 219 |
Stuart what would be your means of interface between the MM & PC? Maybe as simple as a data file say C:\DataFile.DAT which both programs could R/W to? Of course in the future when the MM had an IP presence or could dumped stuff down to a webpage then the PC app could then read from there. RayB from Perth WA |
||||
stuarts Senior Member Joined: 15/06/2011 Location: AustraliaPosts: 199 |
Ray, my Maximite on USB is COM20:. I'm going to write a windows executable that communicates with the maximite program via Com20:. In exactly the same way that you can run a terminal emulator and communicate with a program, my Program will do that. If you wish, it will be a terminal emulator emulator. The weather station program that I currently use is capable of either communicating directly with several different brands of weather station hardware, or it can take its input from a file in a known format. The data in this file is just comma seperated data. The easiest way would be to just have the Maximite output this line using a print statement and have the program at the other end just capture the line and then save it to the file that the weather station software uses. The other option is to have the Maximite use an input statement to request the data type required and have the PC program indicate which parameter that it is looking for and then return it with a print statement. This at least gives you some control of the data returned and make it easier to quit the maximite program by telling it to exit. It also means that you can get data that is more dynamic (wind speed and direction) at a faster rate than the other parameters like temperature and humidity that are a lot more slow changing. In essence, the USB connection as far as the Maximite and the PC are concerned is just a serial connection. Any program can use that connection to transfer any data that is desired. In ways its easier than using a real serial port (my laptop doesn't have one and I'd have to send the characters 1 by 1 down a real serial port where I can do it with a print statement). If I get paranoid I could also generate some sort of checksum to send as well. Stuart Time is nature's way of keeping everything from happening all at once. |
||||
James_From_Canb Senior Member Joined: 19/06/2011 Location: AustraliaPosts: 265 |
You could use TeraTerm to control your weather station and read the outputs. I know you can use a macro to pass a string to the Maximite (like DATE$ = "18/07/2011"), and I understand TeraTerm can capture text displayed on the screen, so you could prefix your results with a string (like RESULT=) to make it really easy to identify. It should therefore be possible to use TeraTerm as the interface between the PC and the Maximite. You could even pass an entire program to the Maximite based on what you want to do. But then again, I do like the idea of a simple custom interface. The TeraTerm documentation can be a bit overwhelming. James My mind is aglow with whirling, transient nodes of thought careening through a cosmic vapor of invention. Hedley Lamarr, Blazing Saddles (1974) |
||||
stuarts Senior Member Joined: 15/06/2011 Location: AustraliaPosts: 199 |
I'd prefer to have a dedicated program running on the PC, it would be much more flexible than any terminal program. Stuart Time is nature's way of keeping everything from happening all at once. |
||||
Dave Everett Regular Member Joined: 24/06/2011 Location: AustraliaPosts: 43 |
As the blurb says, any character typed through the USB port looks like a key press from the keyboard, so setting up an INKEY$ to accept strings is all I need to send control commands. Here's the thing.I have one of my old robots handy. I'd like to use the maximite to read the analog IR distance sensors, read the wheel encoders and generate I2C commands to the motor controller (I'll bit bang the I2C). The maximite calculates the cartesian position (XY) by periodically reading the wheel encoders and deals with low level obstacle avoidance by checking the IR sensors. The maximite also sends the XY position to the PC so I can display it's position on a map. Why not get rid of the PC you say, a very good question. I need the PC to handle the stereo vision head that generates high level obstacle avoidance and localises the robot based on landmark recognition. Somewhere down the track I'd get a little 7 inch vga monitor and drop the vision system as I don't need it on this old robot, just to show the maximite running a robot capable of collision free navigation, running a schedule and responding to user input through the keyboard. |
||||
stuarts Senior Member Joined: 15/06/2011 Location: AustraliaPosts: 199 |
Sounds fun Dave. Stuart Time is nature's way of keeping everything from happening all at once. |
||||
bigdanb Newbie Joined: 29/07/2011 Location: AustraliaPosts: 2 |
Dave, I had pretty easy time sending commands to Maximite on USB using Python code on PC to set outputs etc.. Just havn't had time to play around with reading inputs and data back though i don't think will be difficult. I can send you the code if you want to try it. Regards, Dan |
||||
Keith @ Senior Member Joined: 19/06/2011 Location: AustraliaPosts: 167 |
Stuart Are you using Cumulus for your weather software? Keith The more we know, the more we know we don't know ! |
||||
stuarts Senior Member Joined: 15/06/2011 Location: AustraliaPosts: 199 |
Keith, I am. I'm also looking at getting some 1wire sensors up and running and integrating them as well. Stuart Time is nature's way of keeping everything from happening all at once. |
||||
Print this page |