mobile phone to AVR

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

This question has probably been asked a million times, but when I google with a site:avrfreaks.net everything I get is about a million years old.  I want to move my lighting project to control by phone instead of using radios and a laptop/tablet.  I have a friend who knows how to write apps for phones, and I am wondering what I need to do in hardware to communicate with an ATmega.  Is there an AVR with WiFi built in, or do I need to use an external WiFi module to talk to the phone?  This is all new to me as I dont get out much.

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

WiFi is one way, serial via bluetooth is another.   Try googling "Arduino smart phone control"  should get you lots of hits to research.

 

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

Don't want to do Arduino, though, but that might point me in the right direction.  Thanks Jim.  Do any AVRs have built in bluetooth or WiFi?

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

MarkThomas wrote:
Is there an AVR with WiFi built in, or do I need to use an external WiFi module to talk to the phone?
module

AVR-IoT WG AVRFreaks Giveaway | AVR Freaks

 

P.S.

Bluetooth 4 or 5

There's a recent thread here mostly about RN4871 (ASCII) with some about BM71 (binary) :

https://www.avrfreaks.net/forum/looking-suggestions-wireless-serial-uart#comment-2591351

Transparent UART (wireless UART bridge)

Android, iOS, Chrome OS (Linux VM on select Chromebooks and IIRC one Chromebox; therefore, Android Studio)

Bluetooth 5 adds range to Bluetooth 4

IIRC, Bluetooth 4 mesh networks 8 peripheral roles to one central role; a Bluetooth 5 mesh network is much larger than 8.

Will need a Bluetooth gateway to get to IP

iOS is Bluetooth 4 and sub

 

edits: Chrome OS, mesh, 2nd URL

 

"Dare to be naïve." - Buckminster Fuller

Last Edited: Wed. Dec 12, 2018 - 03:59 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

MarkThomas wrote:
Don't want to do Arduino, though, but that might point me in the right direction. Thanks Jim. Do any AVRs have built in bluetooth or WiFi?

 

Remember Arduino is an AVR, you don't have to use the IDE if you don't want too.

https://www.arduino.cc/en/Main/A... Arduino with BT, again, you can just use the H/W, probably cheaper then buying the components by them selves, besides the H/W is built and proven to work.

Now you just need to write the software.

 

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...

 

 

 

 

Last Edited: Tue. Dec 11, 2018 - 08:59 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Do any AVRs have built in bluetooth or WiFi?

You can get a BT to UART  module for a few dollars, https://www.ebay.com/bhp/hc-06

 

simply pair the module to any phone, tablet, PC etc then you can use any AVR and pretend you have a serial port.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

Arduino - ArduinoBoardBT

Bluegiga WT11u Bluetooth Class 1 Module - Silicon Labs

...

The WT11u is a fully integrated Bluetooth 2.1 + EDR, class 1 module combining antenna, Bluetooth radio, and an on-board iWRAP Bluetooth stack. 

...

Some operator's devices aren't dual-mode (Bluetooth 2 or 3 plus 4 or 5)

WT11u datasheet is behind a wall; Mouser has the datasheet :

https://www.mouser.com/datasheet/2/368/wt11u-datasheet-1317532.pdf

via WT11U-A-AI56 Silicon Labs | Mouser

TX 88mA average, RX 36mA average; Bluetooth 4 and sub are approx an order of magnitude less (coin cell compatible)

 

Edits: WT11u, Mouser

 

"Dare to be naïve." - Buckminster Fuller

Last Edited: Tue. Dec 11, 2018 - 09:21 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If this is for main lighting, I suppose you might want to have more than one device controlling it. Therefore I wouldn't use Bluetooth, as usually one slave can't have more than one master connected to it.

I'd use serial over WIFI, for example with an ESP8622. Small modules with this chip are really cheap and widely available. There is also plenty of code and tutorials around.

For development, you can use a normal USB to UART bridge to debug the connection, which makes thing really easy.

 

A solution I once started but never really finished was to use NRF24L01+ modules for the connection between the lighting and a raspberry pi with a touch screen.

The pi should have acted as both a local controller and a gateway between TCP/IP and the NRF radios.

The NRF link and the local control are working and in daily use, but I never got to create the app for the phone.

I found it rather difficult to make a stable and useful app with Android Studio. I might try again with Qt someday.

 

-Patrick

"Some people die at 25 and aren't buried until 75." -Benjamin Franklin

 

What is life's greatest illusion?"  "Innocence, my brother." -Skyrim

 

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

pawi777 wrote:
Therefore I wouldn't use Bluetooth, as usually one slave can't have more than one master connected to it.
Bluetooth 5's mesh networking is peer-to-peer versus the previous peripheral-to-central.

Some of Microchip's Bluetooth products recently received a Bluetooth 5 cert.

pawi777 wrote:
I'd use serial over WIFI, for example with an ESP8622. Small modules with this chip are really cheap and widely available.
Lack of TLS might be an issue with ESP8266; TLS might be OOTB on ESP32.

Espressif Systems has ESP32 modules that are low price and are a recent arrival at Mouser.

 

Oh .. Arduino for megaAVR and ESP32 :

ARDUINO UNO WiFi REV2

NINA-W10 series | u-blox

 


Exploring Bluetooth 5 - Going the Distance | Bluetooth Technology Website

Espressif Systems Distributor | Mouser

 

Edit: Oh

 

"Dare to be naïve." - Buckminster Fuller

Last Edited: Tue. Dec 11, 2018 - 09:45 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Take a look at Adafruit bluetooth modules, full code is available.  Can do many functions, keyboard, HRM, etc.

 

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

I really like the looks of John's suggestion.  Super cheap and has Rx, Tx, Vcc, Gnd, and En pins.  Perfect for this dodo.  I am staying away from the whole Arduino thing because I have a bare ATmega in my prototypes and I'm using Atmel Studio 7.

 

Thanks John.  That looks perfect, I dont need long range, and it looks like I can plug it right in where I had an RFDigital radio that had Rx and Tx.

 

I had lunch with my friend who does high level programming for web sites and networks and such.  He writes phone apps, but mostly WiFi lately.  He said he was going to do some Bluetooth research, so he can write the app and my code will be essentially unchanged of I just plug John's module in where I now have a radio.  

 

Thanks all.  Moving forward.

 

mark

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

If your app uses simple commands like you can do from a terminal then there are many BT terminal programs around and no need for special apps.

 

In one project I had to test stuff on site that needed me to be several metres away from the equipment, a simple command line and the BT terminal solved the problem.

This shown the PC talking to the HC-06, but I used my Samsung tablet or phone on site.

 

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

You still need a BT to USB serial converter to talk to the laptop with something like PuTTY, dont you.  Oh, or your computer has bluetooth.  My laptops are all too old to have bluetooth, I think.

 

John, what is the difference between the "Master" and "Slave" transceivers on the eBay link you sent me?  They both seem to transmit and receive and seem interchangeable.

 

Is that uCon terminal an app that can be downloaded onto an Android phone?

 

Thanks,

mark

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

or your computer has bluetooth.

I have a USB Bluetooth dongle on the PC. They can be plugged into any device that has USB.

what is the difference between the "Master" and "Slave" transceivers

The HC-05 is a master and the HC-06 is a slave from what I understand, I have an HC-05 but not used it yet. But there may be more to it.

So if you have more than 1 AVRs that need to talk to each other you will need at least 1 HC-05, the rest can be HC-06.

However if you have a phone, tablet or PC that has BT then the AVR/s can be all slaves or HC-06.

Is that uCon terminal an app that can be downloaded onto an Android phone?

Unfortunately not, Windows only. I have tried to persuade the author to make an Android version but he is not interested.

For you phone or Android tablet you can use Blueterm. https://play.google.com/store/ap...

 

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

So it sounds like I need an HC-05 and an FTDI serial to USB to talk to an HC-06 with my old laptop.  Can the HC-06 talk back to the HC-05?  If I want one HC-06 to talk to another HC-06, does it have to go through the HC-05?  Is there some way to name the HC-05s with AT commands so the HC-06 can talk to a specific HC-05?

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

So it sounds like I need an HC-05 and an FTDI serial to USB to talk to an HC-06 with my old laptop. 

You are getting me confused wink you don't really need a HC-05 at all if you just have slaves AVRs, just the HC06.

 

For the PC I have a (pretty old now) Blusoleil  dongle http://www.bluesoleil.com/produc...

 

Or you can use an old tablet or phone with Bluetooth.

 

Does your project involve a master AVR talking to one or more slaves? Anyway just think of the Bluetooth link an RS232 link but without the wires.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

I need to make a usb to bluetooth dongle, and for that I need an HC-05 and an FTDI USB to serial.  Correct?  Then I can open a PuTTY window on my laptop and talk out the HC-05.  Correct? 

 

then with that dongle I can talk to a bunch of different HC-06s. Correct?  Can the HC-06's talk back to the HC-05?

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

No, my project involves my laptop talking to a bunch of AVR slaves, and in the future a mobile phone talking to a bunch of AVR slaves.  But the slaves talk back to my laptop.  The communication is 2 way.

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

I need to make a usb to bluetooth dongle,

No you BUY a dongle like the one I linked to, there are lots of cheaper ones on eBay.

 

May need to wait for someone with more experience that me with BT, I have only used one module at a time.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

It sounds like you have a single HC-06 hooked up to UART on an AVR.  When you talk to the single HC-06 with your USB to BT dongle, is the communication one way, or can the HC-06 talk back to the dongle so you have two way communication with your single AVR?

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

Yes 2 ways comms, like I said above "think of the Bluetooth link an RS232 link but without the wires." Once you pair the devices and Connect it just appears as a normal Com port, COM22 in my case above.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

OK.  I still think I can make a dongle with an HC-05 and a serial-USB adaptor.  Doesn't that make sense?  I have a bunch of those adaptors, and I just ordered a few HC-05s and HC-06s from ebay.

 

But to your knowledge, an HC-06 cannot talk to another HC-06.  Is that correct?  Only an HC-05 and an HC-06 can talk together.  Is that correct?

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

I'd suggest something like a ESP32. HC-05/06 are old hat.

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

I've got some Imagecraft SmartIO modules sit here to play with...

 

https://imagecraft.com/smartio

 

A Bluetooth (BLE) link to your phone which runs a universal app. The GUI is held on the module and pushed to the phone which means you don't need to develop any apps. And it supports iOS and Android.

#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

ESP8266 modules can be programmed directly from within the arduino environment, so there is no need to use them as a WiFi to serial dongle.

 

I have sucessfully used the Wemos D1 mini with the arduino framework and with platformio (I will not use the arduino java contraption).

The Wemos D1 Mini is one of the smallest modules that can be easily used with breadboards and such with no or minimal soldering.

(With minimal solderering I meand that the headers are often loose in the envelope, so theydo not get bent during shipping.)

 

There is plenty of support for the D1 mini, And I believe also updates over the air.

The D1 mini also has a CH340 and can be plugged directly into USB for power and data.

 

Another option is to use an ESP8266 with micropython / circuit python.

Micropython can do REPL over WiFi and you can tinker with it with only a web browser.

 

https://docs.micropython.org/en/latest/esp8266/tutorial/index.html

Doing magic with a USD 7 Logic Analyser: https://www.avrfreaks.net/comment/2421756#comment-2421756

Bunch of old projects with AVR's: http://www.hoevendesign.com

Last Edited: Wed. Dec 12, 2018 - 09:55 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

MarkThomas wrote:
No, my project involves my laptop talking to a bunch of AVR slaves,

For many slaves, you should be looking at wifi and not BT, as BT makes a one for one connection, not a one to many connection!!!

 

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

Topology Options | Bluetooth Technology Website

(3/4 page for comparison of Bluetooth Low Energy with Bluetooth BR/EDR)

Point-to-Point (1:1 device communication)

...

Broadcast (1:m device communication)

...

Mesh (m:m device communication)

...

Bluetooth 5 increases range so that a many-to-many (mesh) network can be feasible within a larger area (though not as large as Wi-Fi as that can reach tens of km as implemented by some cities)

 

"Dare to be naïve." - Buckminster Fuller

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

Kartman wrote:
I'd suggest something like a ESP32. HC-05/06 are old hat.

 

Too late on that.  I ordered some of each.  It will get me started.  I dont mind old hat.  The ebay modules are very simple to connect to serial and I need something simple to get started.

 

ki0bk wrote:
For many slaves, you should be looking at wifi and not BT, as BT makes a one for one connection, not a one to many connection!!!

Does BT do a handshake for the 1-1 connection or does the HC-05 transmit and all the HC-06's will hear it? 

 

I have been using RFDigital radios where I have a home made dongle that plugs into my laptop and transmits to many similar radios that are set up to only listen to the one broadcasting from my laptop.  They dont listen to each other.  Each device has an ID hardcoded into software for that device, so I have to change that ID when I flash the AVR memory.  I send the radio ID I want to talk to, and in software only that one will transmit back.  All the other ones hear the command I send, but just dont do anything.  Of course, when first I start up they all transmit back when I send the command to choose a device so it looks funky on the screen, but after I send the ID of the device I want the first time then only that one talks back, and I can change the ID of the one I want to control and move forward.  Does that make sense?

 

If the HC-05 transmits and all the HC-06s hear it, then I dont have to change any of my code to be able to talk to many from one, which is what made them so attractive.  I haven't done much researching around on BT, but I saw something called "transparent mode" and figured that means any BT device in the area will hear something transmitted from a source.  If two of them set up a handshake type connection, then I am hosed.

 

Brian Fairchild wrote:
A Bluetooth (BLE) link to your phone which runs a universal app. The GUI is held on the module and pushed to the phone which means you don't need to develop any apps. And it supports iOS and Android.
  

 

Thanks for the link, Brian.  Somewhere above someone gave me a link to a terminal emulator app for Android.  I could put that on my phone and I'm done.  I control everything through a PuTTY terminal window and my user interface is the old fashioned kind where I send an "m" and the device on the other end sends the menu and it displays in the PuTTY window.  If I send an "i", it inverts a matrix.  Stuff like that.

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

Over the last 15+ years or so I've been tinkering every now and then with my home built and self designed "home automation" network.

Part of the design is a deamon that runs on a small 3Watt linux board (Cubie).

I can now make a connection from my laptop with netcat and the signal goes via WiFi to a standard router.

From the router it goes over Ethernet to my Cubieboard.

Cubieboard functions as a gateway between ethernet and an RS-485 network.

My RS485 network deliveres 24Vdc and RS-485 data to all the network nodes.

Cabling is with standard CAT5. So I have 2 wire pairs left.

I could combine this with Ethernet, because 100Mbit/s Ethernet only uses 2 of the 4 pairs, while Gigabit uses all 4 pairs.

 

Nowaday's it is more common to use a more standard solution.

There are loads of projects around where an ESP8266 acts as a web server (Including micro python which I mentioned in #25).

But using a protocol like MQTT is probably the best solution.

MQTT starts with some server, which runs on a small Linux box. I believe it is pre-installed on a lot of Linux distributions for the Raspi.

The MQTT server collects data from as many nodes as you could wish for, and also distributes that data to any node that "subscribes" to a certain kind of data.

The advantage of this is that data is always available. A battery fed temperatur sensor for example might wakup every 10 minutes, do a measurement, send the measurement to MQTT and go back to sleep.

MQTT will then tell anyone who want to know (and has rights to know) that the latest temperature was, and probably also all previous values, so yo can draw graphs from the logged data.

The security stuff becomes important if you want to access your data remotely (internet), but you can also run it from a local linux box without a connection to internet if you prefer.

 

Another project to read a bit about is openhab.

Openhab is a quite popular (and big and complex probably also) project and it supports loads of different protocols and hardware.

I think it is the most popular "home automation solution" from the open source world, but I have only experience with my own home grown network.

Loads of people are tinkering with openhab, and a lot of vendor specific gadgets have been reverse engineerd and interfaces made to plug that stuff into openhab.

 

 

Doing magic with a USD 7 Logic Analyser: https://www.avrfreaks.net/comment/2421756#comment-2421756

Bunch of old projects with AVR's: http://www.hoevendesign.com

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

John, thanks for putting up with me yesterday.  I think I got a little pushy.  I really appreciate the info you gave me.  It got me started, even if we are now "old hat"  That goes along with my old body, so I dont mind.  Thanks again.  I appreciate the help.

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

I've learned a bit about 3-D printing, enough to actually have looked

at the AVR code running the printer, and thought, "wouldn't it be cool

to make a version of G-Code to control your house?"  G-code is the

instruction set for the printer (or any CNC) which includes things like,

move to location X,Y,Z, turn on heater, turn on fan, etc.  It's all text

so very easy to send commands, and not too difficult to decode.

 

Your house lighting could be controlled with simple commands like,

"lights in room 3 to 85%", or "ceiling fan in room 8 off".  The actual

text commands might look like "L 3 85;" and "F 8 0;" or similar.

 

Not sure if this is already how it's done by (some) open source home

automation projects....

 

--Mike

 

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

MarkThomas wrote:
... and figured that means any BT device in the area will hear something transmitted from a source.
piconet exists in Bluetooth.

IIRC, piconet's size is up to 1:8 1:7 (1 central, 8 7 peripherals) in Bluetooth BR/EDR; broadcast is available.

Bluetooth Low Energy extends broadcast to 1:many.

Topology Options | Bluetooth Technology Website

(3/4 page)

Broadcast (1:m device communication)

 

edit: strikethru

 

"Dare to be naïve." - Buckminster Fuller

Last Edited: Wed. Dec 12, 2018 - 06:32 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If the HC-05 transmits and all the HC-06s hear it

I don't think that's the case but don't really know.  Remember that the HC-06 MUST be paired first (like all other BT devices) to the master and then there is only comms to that module.

 

I have not delved into BT that much, just enough for what I needed, but there seem to be some hope of success from the post above.

 

There are quite a few posts on the net about similar projects but with negative comments, maybe newer technology is allowing a multi slave system.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

Dunno about anyone else but I want (and do) control my smarthome devices by telling Alexa what I want to happen "Alexa set lights to 85%", "Alexa, switch on Christmas tree" so I'd be looking to do whatever is necessary to fit into this infrastructure.

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

One day the Alexa slaves will rebel and it will be the end of humans.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly