Forum Menu




 


Log in Problems?
New User? Sign Up!
AVR Freaks Forum Index

Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
Chafflube
PostPosted: Jul 08, 2012 - 09:41 AM
Rookie


Joined: Jul 08, 2012
Posts: 21
Location: Adelaide, South Australia, Australia, 5000

G'day, fellow tinkerers. Smile

This is my first post, so please excuse any ignorance that I may display and correct me if I make a mistake of any kind, please.

So, my question is; what is the best overall method (in your honest opinions) to send small amounts of (~20-40bytes) data read by sensors on an Atmega32 periodically to a PC every 5 seconds, wirelessly. Also, it would be preferrable if the Java app running on the PC was able to send commands back to the Atmega32, wirelessly.

The reason I ask this is that I intend on making a hot beverage dispenser (probably coffee), which I would like to send data to a Java app running on a Linux (Fedora) box. This data will likely include information, such as; coffee levels, temperature, current consumption, volume of liquid dispensed, etc.

I am making the assumption that the Atmega32 will be able to send the data to my pc, every 5 seconds. Then my program will parse the data into a somewhat attractive Java Swing GUI, which can be used to read all important data with little effort and then my Java app will (I am hoping) be able to send commands back to the Atmega32 and make it go into hibernation, or something of that nature.

I am hoping that the information within my post is neither inadequate or verbose. If it is either, please inform me.

Thank you very much for reading my question and I await your replies with much anticipation.

-- Dillon Chaffey Very Happy
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
Kartman
PostPosted: Jul 08, 2012 - 01:43 PM
Raving lunatic


Joined: Dec 30, 2004
Posts: 9001
Location: Melbourne,Australia

What do you consider to be 'best'? If you want to expend a bit more effort, you can use cheaper modules but need more software to make them work eg rfm22b from Sparkfun and others. Then you have devices like the xbee modules that are more expensive but do more of the work for you then there's wifi modules which allow wifi enabled devices to connect. Not forgetting bluetooth. If you use the Arduino, there's a number of worked examples using the devices I've mentioned and more. so choose whats best for you.
 
 View user's profile Send private message  
Reply with quote Back to top
dak664
PostPosted: Jul 08, 2012 - 01:52 PM
Posting Freak


Joined: Jun 15, 2008
Posts: 1779
Location: North Carolina USA

Easiest would be to develop the software using a serial link, then replace the wire with RF or IR. More general would be a network link such as UDP client/server. Various home automation protocols use one or the other or both.

Another possibility is a simple webserver that does AJAX pushes to the javascript in a browser, e.g. http://www.sics.se/contiki/wiki/index.p ... mple_Guide
 
 View user's profile Send private message  
Reply with quote Back to top
Chafflube
PostPosted: Jul 08, 2012 - 02:23 PM
Rookie


Joined: Jul 08, 2012
Posts: 21
Location: Adelaide, South Australia, Australia, 5000

Kartman wrote:
What do you consider to be 'best'? If you want to expend a bit more effort, you can use cheaper modules but need more software to make them work eg rfm22b from Sparkfun and others. Then you have devices like the xbee modules that are more expensive but do more of the work for you then there's wifi modules which allow wifi enabled devices to connect. Not forgetting bluetooth. If you use the Arduino, there's a number of worked examples using the devices I've mentioned and more. so choose whats best for you.


I forgot to mention that what I would consider to be the "best" would be a solution that was as cheap and effective (in terms of features) as possible, while still allowing me to have to work to get the module functional and learn in the process. Thank you for your reply. I am hoping to achieve a transmission distance of 30 - 100+ metres. Which of the possible options do you think would be most viable to acquire such a range? Please note that data transmission speed is not a number one priority as I will only be sending ~30 bytes every 5 or so seconds.

-- Dillon Chaffey
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
Chafflube
PostPosted: Jul 08, 2012 - 02:25 PM
Rookie


Joined: Jul 08, 2012
Posts: 21
Location: Adelaide, South Australia, Australia, 5000

dak664 wrote:
Easiest would be to develop the software using a serial link, then replace the wire with RF or IR. More general would be a network link such as UDP client/server. Various home automation protocols use one or the other or both.

Another possibility is a simple webserver that does AJAX pushes to the javascript in a browser, e.g. http://www.sics.se/contiki/wiki/index.p ... mple_Guide


That is a very interesting approach. How much would this cost do you think? I am hoping to spend a total of between $5 and $15 in total. If I was to source the parts from eBay? Also note that I would like "two way" communication between the Atmega32 and the PC. Would this option allow, hinder or flat out prevent this?

Also is there a way that an Atmega32 chip can run a standalone client/server pair? Or would this be extremely difficult and/or require additional parts? Is it possible to run Java on an Atmega32? Or is C my closest option?

Thank you for your reply.

-- Dillon Chaffey
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
dak664
PostPosted: Jul 08, 2012 - 03:32 PM
Posting Freak


Joined: Jun 15, 2008
Posts: 1779
Location: North Carolina USA

All options could be two way. With AJAX push the browser javascript can send commands through bogus web page requests, or by appending a ? string to the page request, e.g. a simple tic tac toe program can request a move based on an arbitrary board position through http://[...]/tictactoe.html?XOX..XOO.

The biggest expense will be on the PC side I think, a ready built 802.15.4 module with USB runs around $50. You can add a SPI module to the atmega32, or consider replacing it with the ~$5 ATmega128rfa1 which has a built in radio. 30 meters is about the maximum reliable range for 3 milliwatt 802.15.4, and that is with good antennas on both ends.
 
 View user's profile Send private message  
Reply with quote Back to top
Chafflube
PostPosted: Jul 08, 2012 - 03:52 PM
Rookie


Joined: Jul 08, 2012
Posts: 21
Location: Adelaide, South Australia, Australia, 5000

dak664 wrote:
All options could be two way. With AJAX push the browser javascript can send commands through bogus web page requests, or by appending a ? string to the page request, e.g. a simple tic tac toe program can request a move based on an arbitrary board position through http://[...]/tictactoe.html?XOX..XOO.

The biggest expense will be on the PC side I think, a ready built 802.15.4 module with USB runs around $50. You can add a SPI module to the atmega32, or consider replacing it with the ~$5 ATmega128rfa1 which has a built in radio. 30 meters is about the maximum reliable range for 3 milliwatt 802.15.4, and that is with good antennas on both ends.


Thank you, very much for sharing with me your insight. My number one priority is minimizing expense (financial). So I think that 802.15.4 may be a bit out of my league, at least for now. Although perhaps I could follow a "quick and dirty" approach and use the serial interface (as you suggested earlier) and connect a radio repeater and receiver to both the Atmega32 and the PC. I believe that this would work, although you seem to be much more knowledgable on the subject that I. What do you think? Would this option likely incur greater costs? Perhaps it is possible to interface an ethernet port with the Atmega32 and attach that to a WiFi router's ethernet port? Although, I am sure that a router, consuming ~12Watts (1amp at 12volts) would drain a robot/coffee machine's battery (yes I am hoping to use a battery, although it is unlikely to be possible with the high current draw of the water heating element) so much so that I would have to fit a 12v car battery (~95amp hours)?

Overall though, do you believe that WiFi would have the best overall price, range and ease of use, as opposed to other radio formats?

-- Dillon Chaffey
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
dak664
PostPosted: Jul 08, 2012 - 04:44 PM
Posting Freak


Joined: Jun 15, 2008
Posts: 1779
Location: North Carolina USA

Certainly, if you can use existing high level software. It would even be the lowest cost, if you can acquire a couple of old routers and install openwrt. Most have a UART you could tie to the AVR. See http://wiki.openwrt.org/doc/hardware/port.serial

I'd test the power issues first, that battery might give a few hundred 500 watt-hour cycles if recharged every day (solar?) but only a few full discharge cycles, especially if left at low charge for a few days.
 
 View user's profile Send private message  
Reply with quote Back to top
Kartman
PostPosted: Jul 08, 2012 - 11:36 PM
Raving lunatic


Joined: Dec 30, 2004
Posts: 9001
Location: Melbourne,Australia

Dillon, you've got a tight budget. At that price range you're looking at the cheapy 433MHz radio modules methinks. For these to work, you need to do a bit of work in the software. The average wireless router will pull 3-4W.

I really tjink you need to look at Arduino. To save $$$ you dont need an arduino board as you can buy the mega328 chips for $5. There's lots of worked examples that will get you moving quickly. Otherwise you'll probably spend a whole lot of time pissing about battling numerous problems.
 
 View user's profile Send private message  
Reply with quote Back to top
stevech
PostPosted: Jul 09, 2012 - 01:48 AM
Raving lunatic


Joined: Dec 18, 2001
Posts: 4779


802.15.4 modules are $20 from some vendors and they eliminate weeks of protocol development/reinvention.
 
 View user's profile Send private message  
Reply with quote Back to top
Kartman
PostPosted: Jul 09, 2012 - 05:22 AM
Raving lunatic


Joined: Dec 30, 2004
Posts: 9001
Location: Melbourne,Australia

http://www.open.com.au/mikem/arduino/VirtualWire.pdf

You really want to get yourself an Arduino board - Jaycar have the freeduino boards for $39.95 - it will save you boocoo (beaucoup) time.
 
 View user's profile Send private message  
Reply with quote Back to top
uracolix
PostPosted: Jul 09, 2012 - 11:19 AM
Hangaround


Joined: Jun 17, 2008
Posts: 456
Location: Meissen, Germany

Another way getting cheap 802.15.4 modules is getting
gifted with a Raven-Kit on a fair or trade show.
However one fundamental law in engineering is, that
the product of time and money to solve a given problem
is almost constant.
 
 View user's profile Send private message Send e-mail Visit poster's website 
Reply with quote Back to top
Chafflube
PostPosted: Jul 09, 2012 - 04:31 PM
Rookie


Joined: Jul 08, 2012
Posts: 21
Location: Adelaide, South Australia, Australia, 5000

Thank you, all, for your detailed and informative responses. I am taking all of them into consideration and will start to work toward finding the most viable option for my project(s). Thank you all again and I hope to hear from you all in the near future.

-- Dillon Chaffey
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
tekmanro
PostPosted: Jul 27, 2012 - 01:10 AM
Newbie


Joined: Jul 27, 2012
Posts: 1


Hi,

Sorry to hijack this thread, but I'm trying to accomplish something similar to Chafflube.

I want to be able to wireless-ly read a temperature sensor as well as issue commands to a relay (possibly an AC dimming circuit) from a computer (or phone, etc.)

I'm a complete electronics newbie (doing high-level software development by trade), please excuse my newbie-ness.

I'm also trying to come up with a cost-effective way to accomplish this. One option I considered is:
ATMega328P $4
nRF24L01+ transceiver $5
Board and power regulator, crystal, etc. 12$

I have a server PC running non-stop, so I'll dedicate a serial port with a max232 and another nRF24L01+ transceiver (~$10).

So if I add this all up, I get around ~$31. That seems a tad expensive for what I need.

I know this sounds ludicrous for my application, but a Raspberry Pi goes for $25 (+ cheap-o USB Wifi dongle for $7) takes me to about the same price (and I don't need to keep my server on). It has about as many GPIO as the 328 for interfacing with the sensor/relay.

Are there cheaper options available for wireless transmission using AVR? Is the idea of using a full-blown ARM computer for reading a temperature and switching a relay idiotic? Smile

Thanks!
 
 View user's profile Send private message  
Reply with quote Back to top
dak664
PostPosted: Jul 27, 2012 - 02:45 PM
Posting Freak


Joined: Jun 15, 2008
Posts: 1779
Location: North Carolina USA

Mass production makes wifi cheaper, but it won't run very long from batteries. Sounds like you would have external power on the remote end anyway, however the relay brings up the question of EMI tolerance.

Other considerations are how to address multiple devices, and the minimum acceptable response time. wifi solves all that, but later on you might regret running failure-prone and power hungry processors and protocols.

802.15.4 is designed for a medium range using low power (by using low symbol rates), and can run for a week on two AA batteries, or much longer by trading response time for battery life. A SOC like the atmega128rfa1 could be put together for less than $20.

For really cheap, $2 would buy an infrared diode and detector bit banged by attiny25, and battery life could be comparable to TV remote controls if the units could be similarly aimed at each other.

The best method to choose a wireless link is to get everything first running with a reliable wired connection so you can determine what the overall parameters need to be - power consumption, data rate, response time, and reliability,
 
 View user's profile Send private message  
Reply with quote Back to top
Chafflube
PostPosted: Jul 29, 2012 - 07:54 AM
Rookie


Joined: Jul 08, 2012
Posts: 21
Location: Adelaide, South Australia, Australia, 5000

dak664 wrote:
Mass production makes wifi cheaper, but it won't run very long from batteries. Sounds like you would have external power on the remote end anyway, however the relay brings up the question of EMI tolerance.

Other considerations are how to address multiple devices, and the minimum acceptable response time. wifi solves all that, but later on you might regret running failure-prone and power hungry processors and protocols.

802.15.4 is designed for a medium range using low power (by using low symbol rates), and can run for a week on two AA batteries, or much longer by trading response time for battery life. A SOC like the atmega128rfa1 could be put together for less than $20.

For really cheap, $2 would buy an infrared diode and detector bit banged by attiny25, and battery life could be comparable to TV remote controls if the units could be similarly aimed at each other.

The best method to choose a wireless link is to get everything first running with a reliable wired connection so you can determine what the overall parameters need to be - power consumption, data rate, response time, and reliability,


Thank you for responding to Tekmanro and I, Dak664. The idea of first testing our circuits with a reliable, wired connection is so obvious that I had not yet even considered that. That is a great idea, I wish I had of thought of that earlier. It is hard to believe that a WiFi device could run for so long on just 2 AA batteries.

Is radio, bluetooth or WiFi a better choice for medium range (~250m), medium data rate (24kbps), disregarding battery life (as I will be using a 12v 90AmpHour car battery)? This will be used on a robot, which I must be able to receive data from, which will then be fed from a custom Atmega32-powered receiver into my PC and displayed in a custom Java app.

I understand that bluetooth would be sufficient in terms of my required data rate, but is limited to ~100m (high powered transceiver), but in order to achieve my desired range AND data rate, what is my best wireless option, again, disregard power consumption.

Thank you, all.

-- Dillon Chaffey Smile

_________________
If I have been able to see farther than others, it is because I stood on the shoulders of giants. - Sir Isaac Newton
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT + 1 Hour
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2006 The PNphpBB Group
Credits