Connecting ATmega with notebook

Go To Last Post
13 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello,

I have very simple project with electronic load for testing batteries and calculating their capacity. I use ATmega32's A/D converters to check voltage of batteries/voltage on load. I check every few seconds and I want to send it to my laptop, where all I have is an USB connector and make graphs with voltage history, either immedietly, or just save it somewhere and then send it all at once.

 

But I have no idea where to start or how to "search" properly. All I can find, when someone is asking the same question, is "buy this", but no one mentions how to use it step by step. I mean things like how to connect it with usb port, and what program to use to get received data into variables and make graph in some programming language. Everybody only checks with serial terminal. Of course i found something, but none of that is what I am looking for. Can you please recommend me some links with tutorials on this topics that you consider good?

 

Thank you for reading.

Last Edited: Tue. Mar 6, 2018 - 05:09 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Use a USB-to-UART converter.

 

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

awneil wrote:
Use a USB-to-UART converter.
On ebay (where there are 1,000's of these things for $1 . .$2) search "USB TTL" to get the right thing.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Agree -

 

One of the common converters is FTDI FT232R if you want to plug a USB cable directly into your battery test board. If this is a one-off device, then you might try the USB "dongle" with logic level interface such as FTDI's TTL-232R-3V3 (for a 3.3V logic system or TTL-232R-5V (for a 5V logic system). These are a little expensive but they save a lot of time and give something guaranteed to work.

 

One caution with all of these FTDI products. The Tx pin of the interface device goes to the Rx input of the MCU UART and the Rx pin of the interface device comes from the Tx output of the UART.

 

Jim

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I assume you have some programming experience because you have created your electronic load. 

 

1) You are going to have to modify your code to send the result to the AVR's serial port.

2) You will need a serial to USB adaptor. I suggest a lead from FTDI, the TTL-232R-5V (or the 3v3 version if your chip runs on 3v3.

3) You need something on your laptop to read the USB serial port and display it. I suggest https://www.electronic-software-...

 

How to hang this together?

 

Download the Realview manual. It tells you what format you need to output from the AVR. It will also tell you how to use Realview. That takes care of step 3). Step 2) simply requires you to install (maybe) a windows driver for the FTDI lead. So that leaves just step 1). As you wrote the software it will will need you to research how to use the AVR serial port.

#1 This forum helps those that help themselves

#2 All grounds are not created equal

#3 How have you proved that your chip is running at xxMHz?

#4 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand." - Heater's ex-boss

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Not that none of this is actually specific to ATMega - the same would apply to connecting any UART to a USB host.

 

The fact that the UART, in this case, happens to be in an AVR is irrelevant.

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am gonna look into it. Thank you for all your answers!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Try these too(might now bee currently up to date for win 10)

 

https://www.mrexcel.com/forum/excel-questions/488335-receive-data-com-port.html

 

http://www.instructables.com/id/Sending-data-from-Arduino-to-Excel-and-plotting-it/

 

there are plenty more out there, many use VBA in concert with excel

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The Arduino environment has a serial plotter built in, look in Tools/Serial Plotter, it's very easy to use, just send your data to the serial port as Comma Separated Values and it will plot the data automatically.

Or if you again send your data as CSV, capture the data using any serial terminal program and load the data file into excel, it under stands CSV and will build the table for you.

Then you can do anything you want with the data including graphing it with excel.

 

 

Jim

 

Click Link: Get Free Stock: Retire early! PM for strategy

share.robinhood.com/jamesc3274
get $5 free gold/silver https://www.onegold.com/join/713...

 

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 what program to use to get received data into variables and make graph in some programming language.

Welcome to the Forum.

 

As mentioned above, the microcontroller USART to USB bridge gives you serial data into your PC, which is typically accessed via a Com Port, (Com1, Com2...).

 

You can certainly use a canned PC program to display the data, but sometimes you want to save the data, or print out the data that was carefully captured by your micro.

 

You can also write your own program to read in the data and graphically plot it.

You can use whatever language you are most familiar with.

 

I'm not much of a programmer, but I play around with Basic in its various forms.

If you have Windows on your PC you then have access to a free version of MS Visual Basic or Visual Studio.

There are lots of examples on line, and tutorial sites, which helps when one is trying something new.

 

Here is an example output from a project done a few years ago, micro to FTDI chip to PC's USB port to plotting the sampled data, and displaying a few statistics on the waveform.

 

Good luck with your project!

 

JC

Edit: Typo

 

Last Edited: Wed. Mar 7, 2018 - 03:32 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

gridril wrote:
what program to use to get received data into variables and make graph in some programming language

The recommendation is that you use a USB-to-UART converter, so that data from your microcontroller appears at a COM port on the PC.

 

The COM port is a standard part of the PC system - so any programming environment on the PC should be able to receive data from it.

 

So you just choose a PC programming language / environment on the PC that you are familiar and comfortable with.

 

This, of course, assumes that you are familiar with some PC programming language(s) / environment(s) - if that's not the case, then you have a lot of learning to do!

 

These people have free tools for you to receive serial data direct into Excel: http://www.windmill.co.uk/windmill7.html

 

Everybody only checks with serial terminal.

and what's wrong with that?

 

A serial terminal will allow you to capture the data without any serial port programming at all, and save it to a file

 

You can then load that received data file into any standard analysis application of your choice; eg, Excel.

 

eg, see: https://www.avrfreaks.net/commen...

 

 

(other spreadsheet programs are available)

 

 

EDIT

 

typos

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
Last Edited: Wed. Mar 7, 2018 - 08:46 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You should use a converter or connect device to computer network.

 

This converter may be USB-UART or UART-RS232 converter.

 

You may connect the device to network by a Ethernet adapter. For example, you may use Wiznet 5100 or Wiznet 5500.

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I think Ethernet is going to be a bit beyond the OP's capabilities - don't you?

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...