BasicMicroUK - Forums

www.basicmicro.co.uk
It is currently Wed Apr 25, 2018 7:31 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 32 posts ]  Go to page 1, 2, 3  Next
Author Message
 Post subject: Wifi
PostPosted: Sun Oct 17, 2010 4:50 am 
Offline
Citizen

Joined: Sun Oct 17, 2010 4:46 am
Posts: 13
Has anyone connected one of these boards to the internet via wifi. I think I read that there was usb connectivity possible on these boards, so one could hook up a usb wifi dongle? Sorry if I am way out to lunch but I need an alternative to expensive SBC type computing. i.e. Beagle board or Gumstix. Any suggestions would be really appreciated.

Thanks

Brad


Top
 Profile  
 
 Post subject: Re: Wifi
PostPosted: Sun Oct 17, 2010 4:51 pm 
Offline
Master
User avatar

Joined: Tue Jul 07, 2009 5:06 pm
Posts: 120
Location: Wisconsin USA
I don't believe these micro controllers have direct usb connectivity as they would need drivers and what not, however you can use a Roving Networks wifi serial adapter.
SMD module, requires very fine soldering
http://www.sparkfun.com/commerce/produc ... s_id=10004

Same thing equipped with a breakout board for easier use.
http://www.sparkfun.com/commerce/produc ... ts_id=9333

They link to a wireless router or access point. You can then connect to them using your home's IP address and the appropriate port from anywhere.
Or access them from within your network with the appropriate network IP.
Roving networks offers their own network terminal program, Though you may need to write your own terminal program if you want to customize it.
Now then there are additional modules you should consider.
http://www.rovingnetworks.com/pricing.php

The RN-122 was always the most interesting to me with it's dual UARTs.

Roving networks wifi adapters come preprogrammed with their own firmware, however you can write you own, i mention this because these adapters also have general I/O pins, which you can program in directly for sensors. An obvious sensor would be battery level, it can by pass your primary micro controller.
Or you can even power on and off multiple micro controllers remotely.

Also this will make it much easier
Zoomkat's Web page arm control (ssc-32)
Use his code, and just reconfigure it for your needs.
Just save the HTM file and edit it from there. Though if you need help programming the HTM file, zoomkat would be the one you ask directly.

_________________
Image
Basic Micro Blog
Universal Robot Controller


Top
 Profile  
 
 Post subject: Re: Wifi
PostPosted: Mon Oct 18, 2010 5:37 pm 
Offline
Citizen

Joined: Sun Oct 17, 2010 4:46 am
Posts: 13
Ok this is exactly what I was looking. For, it even looks like with the added functionality of the wifi board I can eliminate the microprocessor completely. This is good due to the price point I need to reach. Thanks for the help.

Brad


Top
 Profile  
 
 Post subject: Re: Wifi
PostPosted: Mon Oct 18, 2010 6:58 pm 
Offline
Master
User avatar

Joined: Tue Jul 07, 2009 5:06 pm
Posts: 120
Location: Wisconsin USA
I doubt the wifi board offers the functionality you'll need. The general IO pins on the wifi board aren't really intended for stuff like servos, I2C, SPI, or other advance sensors. And programming them will be hell, unless you're an expert in programming.
You might be able to get some temp sensors, or some range sensors working, but that's about it.
It probably wouldn't have a very easy programming language, because you can't just program it like you would a micro controller.
Because it's programming also controls it's wifi, so if you touch that, you could easily brick the whole thing.
You'd have to learn how to program the wifi adapter, for it's original use, before you can add any functionality, so you don't destroy the thing.

Also these wifi boards REQUIRE and external programmer. Though they are command configurable, they are not command programmable. So you need to buy their developer kits.
Look under "Writing your own firmware"
You'll need to contact them for prices, but i can guaranty they aren't cheap.

It's intended to be paired with a micro controller.
I'd suggest the basic atom pro over the basic atom.

Now that we got that covered, i use a bluetooth uart adapter, which also has general IO pins that can be programmed, and like the wifi adapter, i can use them, but if i goof up even a tiny bit, the bluetooth adapter is gone.
Where as the basic atom pro, you can repeatedly flash it until everything is working just right.

So if you do go wifi, pair it up with a micro controller like the basic atom pro.
The wifi is just a link, it won't offer the functionality, or compatibility of the basic atom pro.
Generally you just set the configuration with serial commands and forget it, set and forget, just plug it in and let it link up.

By the way, i tried reprogramming my bluetooth adapter to act as it's own micro controller, but that was some seriously advance stuff, everything was done in hex. The basic atom/pro comes with the basic atom studio, which makes programming the microcontroller a breeze.
Programming bluetooth adapters is all manual, in hex. I can't speak for sure about the wifi adapter though.


If you're like me, trying to save money, get a basic atom pro 28, and a bluetooth uart adapter.
If you're good at soldering.
Bluetooth UART adapter
paired with
Logic level converter

They take about 5 minutes or less to configure, they are fast and very easy to use. And they connect easily to a USB bluetooth dongle, which you can buy online for $15 at newegg if you don't already have one.
Class 1 usb bluetooth dongle
Bluetooth serial adapters, show up as virtual com ports. When connected, your computer will treat it like a real com port.


I apologize, i never meant to give you the impression the roving networks wifi dongle will act as it's own micro controller. And yes, if you're an expert programmer, it should be possible, but if you're on a budget like i am, then it's not gonna happen. The Dev kits are not going to be cheap.
Also if you have less than 10 years of hex programming, or other programing language experience i'd suggest against trying to program it yourself. And just use it as a serial link to a different micro controller.

If you tell me your budget, and what parts/tools you already have, i can help you get started. Help you find parts within your budget.
Also let me know what your project goal is. There are plenty of experts in the basic atom, here at basic micro and at the http://www.lynxmotion.net forums that would love nothing more than help someone get started.

_________________
Image
Basic Micro Blog
Universal Robot Controller


Top
 Profile  
 
 Post subject: Re: Wifi
PostPosted: Mon Oct 18, 2010 8:08 pm 
Offline
Citizen

Joined: Sun Oct 17, 2010 4:46 am
Posts: 13
Wow, that was a great view of the product. I have a working prototype using the Gumstix SBC plattorm. Just too expensive. Here is what I have working at this time.

3 Buttons and 3 LEDs.

I use the buttons as a binary input... 000 - > 111. When a button is pushed then a url is sent out like.

www.website.com/main.php?userid=1&action=(000->111)&password=(md5 hash of the date and a key)

Then the server will reply back with a status like.. Ok, ERR, SSH etc. and a led status. ie

status=OKpassword=kjafdkjdskjlkjled=(000->111)

The remote client (box with buttons and led) would authenticate the response and light up the LED's as appropriate.

Reading the user manual. It looks like I could get it to do the button thing.. but with out all the LED feed back and authentication. I ordered the RN-121 to play with and then if I can get it to work. I think I could order the $40 RN-131C for my production run.

If could stay under a $100 for a working unit that would be ideal. so if I can't do it with just this unit then I would think this would be adiquate.

BasicATOM Pro One-M OR (Nano 18)
RN-131C
Power Supply with voltage regulation
3 buttons
3 leds
Buffer circiut for buttons
Applifier Circiut for LEDs.
serial connection between the two units.

Don't think I need much processing power for this smiple task.

Brad


Top
 Profile  
 
 Post subject: Re: Wifi
PostPosted: Mon Oct 18, 2010 8:46 pm 
Offline
Master

Joined: Mon Aug 18, 2008 1:26 am
Posts: 799
Location: CA bay Area
Quote:
Buffer circiut for buttons
Applifier Circiut for LEDs.

What do you need a buffer circuit or amplifier (you said "applifier") circuit for? You connect everything straight to the module. That's the beauty of the Atom parts. Admittedly, the Nano has 20 mA per pin, so can drive an LED harder if you needed that, but the Pro parts do OK in any typical at-home situation.
What am I missing here?

_________________
kenjj
http://blog.basicmicro.com/
http://kjennejohn.wordpress.com/


Top
 Profile  
 
 Post subject: Re: Wifi
PostPosted: Mon Oct 18, 2010 8:50 pm 
Offline
Master
User avatar

Joined: Tue Jul 07, 2009 5:06 pm
Posts: 120
Location: Wisconsin USA
For a task like this, the nano 18 would work just fine.
To program the nano, you either need a USB nano programmer, or connect it using the diode/resistor circuits listed in the manual. The nano programs using TTL, not direct RS-232. So you'll need an RS-232 to TTL converter.

Heres some simple button code, i actually had it writen up already.
Where the ";output" is, is where you would have a serial output command.
Using hserial on pins 2 and 5 of the nano 18 will work wonderfully with a wifi/bluetooth uart adapter.

Edit: I didn't use the button code, but the button code will work just fine. I just found this way to be easier.
Code:
buttona var bit   ;workspace for the buttons.
buttonb var bit
buttonc var bit

main
buttona = in8    ;P8 links the buttons to the input pins.
buttonb = in9    ;P9
buttonc = in10   ;P10

if (buttona = 0 and buttonb = 1 and buttonc = 1) then    ;button A only, the numbers are reversed so 0 is pressed
pause 100
 ;output
pause 100
elseif (buttona = 1 and buttonb = 0 and buttonc = 1)    ;b only, 0 = pressed, 1 = open.
pause 100
 ;output
pause 100
elseif (buttona = 1 and buttonb = 1 and buttonc = 0)    ;C only
pause 100
 ;output
pause 100
elseif (buttona = 0 and buttonb = 0 and buttonc = 1)    ;A and B together
pause 100
 ;output
pause 100
elseif (buttona = 1 and buttonb = 0 and buttonc = 0)    ;B and C
pause 100
 ;output
pause 100
elseif (buttona = 0 and buttonb = 1 and buttonc = 0)    ;A and C
pause 100
 ;output
pause 100
elseif (buttona = 0 and buttonb = 0 and buttonc = 0)    ;A B and C
pause 100
 ;output
pause 100
endif
goto main


The I/O pins on the Nano 18 can put out 25mA (20mA to be safe) which should be enough for low power LED's.
LED Calculator
Just calculate the LED's voltage and MA, and put in the atoms 5v output.
Total power output should not exceed 90mA on all pins. If you need more, i can help you setup transistor switches.

LED's with the proper resistor can be attached to the I/O pin and be turned on and off with simpel high low commands.

high p6 ;enables LED on P6
low P6 ;turns off LED on p6

Same commands work with the transistor driver.
I included the quick schematics for an LED driver, hopefully you won't need it.
I think i have the diode correct, but Kenjj can correct it if it's wrong.


Attachments:
LED driver.JPG
LED driver.JPG [ 15.39 KiB | Viewed 9227 times ]

_________________
Image
Basic Micro Blog
Universal Robot Controller
Top
 Profile  
 
 Post subject: Re: Wifi
PostPosted: Tue Oct 19, 2010 12:06 am 
Offline
Citizen

Joined: Sun Oct 17, 2010 4:46 am
Posts: 13
Thanks for the added info. The reason for the buffer and amp circuits is that the Overo SBC could only source/sink 4 mA and 1.8v logic so I had to condition the input and amp the output to drive the led's hard enough. Now the same serial/ttl connection point for programing the nano would be the same one used to connect the nano to the wifi board right? So I would do the programing, then disconnect the pc and then connect the wifi module and test. Ok. This is going to be alot of fun to build. Can't wait to get all the parts. Instead of just leds can I drive the lcd display with the nan0 18 chip? looks like there is enough lines to do it.

Brad


Top
 Profile  
 
 Post subject: Re: Wifi
PostPosted: Tue Oct 19, 2010 12:57 am 
Offline
Master
User avatar

Joined: Tue Jul 07, 2009 5:06 pm
Posts: 120
Location: Wisconsin USA
You can use the same serial line to program as you do to communicate with the wifi controller.
Though i'd personally suggest using hserial on lines P2 (RX) and P5 (TX)
Yes you can drive an LCD display, but i'd strongly suggest a Serial LCD.
http://www.sparkfun.com/commerce/produc ... ts_id=9395

As it only needs a single serial line, instead of like 7 lines for a parallel LCD. They are also VERY easy to use.

Keep in mind, if you're using a 1.8v wifi adapter, or even 3.3v, you'll most likely need a logic level converter.
http://www.sparkfun.com/commerce/produc ... ts_id=8745
Weak signals sometimes won't register between to devices.
5v signals from the nano could damage a 1.8v device, unless it specifically states it's 5v tolerant.
And sometimes 1.8v signals wont even register on a 5v device, and may just be ignored as noise.

You'll need a 5v power supply, including for the screen, which a common radioshack 5v regulator would work fine. Basic micro here sells them as well. Always good to have a FEW of them.
You'll also need other voltage regulators if you use devices at lower voltages such as 1.8v or 3.3v. Contact me later about those. My dinners getting cold. Have fun with your project.

_________________
Image
Basic Micro Blog
Universal Robot Controller


Top
 Profile  
 
 Post subject: Re: Wifi
PostPosted: Tue Oct 19, 2010 8:14 am 
Offline
Master

Joined: Mon Aug 18, 2008 1:26 am
Posts: 799
Location: CA bay Area
Quote:
Now the same serial/ttl connection point for programing the nano would be the same one used to connect the nano to the wifi board right?

That depends. The Nano uses a single pin to program, then do serial communications afterwards. And it needs the Nano USB programmer to do these two tasks. It and the PC (or WiFi device) can only talk in one direction at a time. This is called half-duplex. If your WiFi unit needs TxD and RxD lines (two lines), then you'll have to use the TxD and RxD of the Nano's internal USART, as Fallentine has said. You could use two bitbang serial pins, one for serial input, the other for serial output, but these are problematic. And slower. The hardware USART will do 57600 Baud, and the bitbang can't do better than 38400.

Whereas the Atom Pros have serial ports that use both TxD and RxD, up to 115200 Baud. The Pro40 has two internal USARTs, an instructions-per-second rate that blows Nanos out of the water, and has 32-bit registers, which means 32-bit math. And costs 4 to 9 times more than a Nano18. Trade offs. Always the trade offs.

_________________
kenjj
http://blog.basicmicro.com/
http://kjennejohn.wordpress.com/


Top
 Profile  
 
 Post subject: Re: Wifi
PostPosted: Tue Oct 19, 2010 4:09 pm 
Offline
Citizen

Joined: Sun Oct 17, 2010 4:46 am
Posts: 13
Ah ok getting a clearer picture. My application is not time sensitive in the sense that I have worry about mili seconds. My time resolution is more like 5 second response times so I could get away with 300 baud ;) I am gonna read the docs that I have on the equipment and then start to create a workable schematic.Once I get a workable solution I will post it for you guys and see what you think.

Thanks for the help.

Brad


Top
 Profile  
 
 Post subject: Re: Wifi
PostPosted: Tue Nov 02, 2010 7:15 am 
Offline
Citizen

Joined: Sun Oct 17, 2010 4:46 am
Posts: 13
Is there ever an issue with switch bounce? In the other project I had to put that circuitry in, Is that nano microprocessor immune to it or should I still be worried about it?

btw I got my nano dev board now I am just waiting on the wifi module. Tis very slick!

Thanks
Brad


Top
 Profile  
 
 Post subject: Re: Wifi
PostPosted: Tue Nov 02, 2010 9:40 am 
Offline
Master

Joined: Mon Aug 18, 2008 1:26 am
Posts: 799
Location: CA bay Area
Hey, Brad, you've been gone a while!

If you have a routine with an input pin waiting for a change in level, it is always a good idea to put in a "debounce" routine:
Code:
loop_here   ; stay here while waiting for switch press
;; In this routine we are looking at P8, an input.
;; A "1" means a high, which we have because we are using a pullup resistor in this case.
;; A "0", or low, comes when we press the momentary Normally Open (N/O) switch,
;; which is connected between ground and the P8 pin.
IF IN8 = 1 then loop_here  ; run in loop here, the "1" is a high.
PAUSE 25  ; We fall through to this pause when a low is first detected. Could just be noise.
IF IN8 = 1 then loop_here  ; After 25 mS, we have a solid low (switch pressed) or the noise has passed. If just noise, go back to constant loop. Otherwise, do switch-pressed code.
;; This next routine is what we do while the switch is pressed down.
do_something  ; a label to jump to while switch is pressed, input is low ("0")
... code to do ...
IF IN8 = 0 then do_something  ; OK, we keep looping to do this job while switch is down.
PAUSE 25  ; Input falls to this when a high is seen, switch is probably released.
IF IN8 = 1 then loop_here  ; If still high after 25 mS, go back to waiting for switch press.
GOTO do_something  ; If still low, do switch-pressed code, wait for switch release.

This code means nothing happens (outside of looping, waiting for level change at P8) until switch is pressed. The main thing to note is how the loops are handled. One loop is based on a constant high; the other a low; and change only happens if the new level is still true 25 mS after the level change is first seen.
If you want to run code continuously, and look for the switch press as just one of many jobs:
Code:
MAIN
... code to run ...

;; Look for switch press at end of other code
IF IN8 = 0 then
PAUSE 25
IF IN8 = 0 then  ; still low, do the following command
GOSUB SW_Routine  ; go to a switch-pressed subroutine
ENDIF
ENDIF  ; eventually reaches this point, conditional is done

GOTO MAIN  ; repeat MAIN code
; *** Subroutine(s) Go(es) Here ***
SW_Routine
... switch-pressed code here ...
RETURN  ; back to where you were in MAIN

Good luck with your project!

_________________
kenjj
http://blog.basicmicro.com/
http://kjennejohn.wordpress.com/


Top
 Profile  
 
 Post subject: Re: Wifi
PostPosted: Fri Nov 05, 2010 9:21 pm 
Offline
Citizen

Joined: Sun Oct 17, 2010 4:46 am
Posts: 13
ok I have all my components now. Here is a schematic of what I am doing.

Attachment:
basicskem.png
basicskem.png [ 41.23 KiB | Viewed 9136 times ]


ok so based on what you guys were saying..
- the led's are gonna be driven directly from the nano18 with a couple of current limiting resistors.
- next the buttons (normally closed) will be in a high state providing 5v to the inputs directly to the nano 18
- power regulator circiut to provide 5.0v
- IC3 is my wifi module from roving networks.
- the switch is used to put the chip into adhoc mode for configuration
- P27 is Receive (IN) TTL
- P26 is Transmit (OUT) TTL
- P24 is RTS

Does this look like it makes sense. I know with out having the pin out for the wifi module you can't know what is need there but the rest of it does it look ok?

Thanks

Brad


Top
 Profile  
 
 Post subject: Re: Wifi
PostPosted: Fri Nov 05, 2010 10:26 pm 
Offline
Master

Joined: Mon Aug 18, 2008 1:26 am
Posts: 799
Location: CA bay Area
Mostly looks OK.
1. Try to avoid using "P" numbers when you are discussing pin numbers, use "pin 24" and the like. The Atom's I/O pins have "P" designations, and the Nano 18 doesn't have P24, P26 or P27 for I/O.
2. Add two small electrolytic capacitors in the regulator circuit. One in the input; one in the output. Make the input cap larger than the output cap so current tends to flow into the regulator after killing power.
3. The Nano 18's pin 4 is reset. Unless your IC3 is gauranteed to supply 5V to this pin all the time, except during power up when you NEED a brief low level, you should have a 10K Ohm pullup resistor. It wouldn't hurt to add a RESET switch to this pin, either.

Have a nice project.
ken

_________________
kenjj
http://blog.basicmicro.com/
http://kjennejohn.wordpress.com/


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 32 posts ]  Go to page 1, 2, 3  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

phpBB SEO