|
|
| (4 intermediate revisions by the same user not shown) |
| Line 1: |
Line 1: |
| | Arduino stuff. |
|
| |
|
| [[Arduino/Morse Code Libraries]]
| | =Links= |
|
| |
|
| =Arduino Plus Wifi=
| | * Adafruit project list: https://learn.adafruit.com/series/learn-arduino |
| | | * RFDuino: https://www.sparkfun.com/products/13209 and http://www.rfduino.com/shop/index.html |
| I bought a couple of 8-pin Wifi cards to connect with an Arduino board to add wifi to some Arduino projects. We'll see how that goes. Here's a photo of one of the chips:
| | * Arduino at DX Zone website: http://www.dxzone.com/cgi-bin/dir/jump2.cgi?ID=20422 |
| | |
| [[Image:ArduinoWifi.jpg|300px]]
| |
| | |
| ==ESP8266 Chip==
| |
| | |
| This is an ESP8266 chip, which is a serial-over-wifi chip. More information about this product: http://www.vetco.net/catalog/product_info.php?products_id=16958
| |
| | |
| Documentation for this product: http://www.vetco.net/catalog/product_info.php?products_id=16958
| |
| | |
| More information on projects and interfacing with it: http://www.seeedstudio.com/wiki/WiFi_Serial_Transceiver_Module
| |
| | |
| Manufacturer Expressif provides a nice set of pages with information/discussion/project ideas: http://bbs.espressif.com/
| |
| | |
| These are actually pretty nifty chips, much more nifty than I originally thought: you can hook up a GPIO to the chip, and have it act as a standalone chip running an application on its own.
| |
| | |
| From their page: "Our ESP8266 Wifi Module is a low-cost and easy-to-use alternative to expensive wifi shields. This module is built around a powerful onboard microprocessor that features a built-in TCP/IP stack which handles all of the heavy lifting - leaving your Arduino free to communicate using simple serial and AT commands."
| |
| | |
| ==Serial Interface to Wifi Chip==
| |
| | |
| To interface with the wifi chip via an Arduino, a Raspberry Pi, or a computer, you can use a serial connection.
| |
| | |
| The serial connection consists of four pins:
| |
| * Ground pin | |
| * Voltage pin
| |
| * RX pin
| |
| * TX pin
| |
| | |
| The RX of device 1 is hooked up to the TX of device 2, and vice-versa.
| |
| | |
| ===Useful Hardware===
| |
| | |
| You will need some hardware to talk to the wifi chip to program it. Specifically, you need a converter to turn 5V logic signals into 3.3V logic signals. You also need a separate power source for the wireless chip to ensure it can draw the full 300 mA it requires.
| |
| | |
| USB-to-Serial TTL converter:
| |
| * good for debugging via serial, doing one-off tasks via a computer
| |
| * advantages: separate power supply
| |
| * disadvantages: you can only interface with the wifi chip via the computer (but, uh, that's kind of the point of serial)
| |
| | |
| <!--
| |
| USB to serial TTL chip:
| |
| * this is necessary for you to interface with the wifi chip with any ol serial device
| |
| * advantages: allows you to use a Raspberry Pi or an Arduino
| |
| * disadvantages: may require soldering, so need to find the right board
| |
| -->
| |
| | |
| next up, we figure out how we control this thing directly from an Arduino - do you still try and send serial signals to the thing?
| |
| | |
| ===Useful Links===
| |
| | |
| bi-directional logic converter: 3.3V to 5V (very cheap): https://www.sparkfun.com/products/12009
| |
| | |
| 3.3V to 5V analog how-to, guide, tips and tricks: http://www.newark.com/pdfs/techarticles/microchip/3_3vto5vAnalogTipsnTricksBrchr.pdf
| |
| | |
| usb-to-serial TTL usb converter hardware: https://www.adafruit.com/products/954
| |
| | |
| usb-to-serial TTL usb converter guide: http://villagescience.org/running-raspberry-pi-usb-serial-ttl-adapter/
| |
| | |
| sparkfun version of the esp8266 (more pins?): https://learn.sparkfun.com/tutorials/esp8266-thing-hookup-guide/hardware-overview
| |
| | |
| another version with more pins: http://reflowster.com/blog/2015/05/11/esp8266.html
| |
| | |
| github library: https://github.com/willdurand/EspWiFi/blob/master/EspWiFi.h
| |
| | |
| almost exactly the same hardware, using a serial-to-TTL converter: http://williamdurand.fr/2015/03/17/playing-with-a-esp8266-wifi-module/
| |
| | |
| esp8266 wiki: http://www.esp8266.com/wiki/doku.php?id=getting-started-with-the-esp8266
| |
| | |
| ===Useful Code===
| |
| | |
| This page [http://www.seeedstudio.com/wiki/WiFi_Serial_Transceiver_Module] works by connecting an output signal from the Arduino to a USB-TTL serial converter chip. This signal is then sent back to the Arduino. The signal is (presumably) routed around to the Arudino's TX pin, and the Arduino's TX pin is hooked up to the Wifi chip's RX pin. Similarly, the Arduino's RX pin is hooked up to the Wifi chip's TX pin. This way, serial signals are routed through the USB-TTL converter.
| |
| | |
| <pre>
| |
| #include <SoftwareSerial.h>
| |
| #define SSID "xxxxxxxx"
| |
| #define PASS "xxxxxxxx"
| |
| #define DST_IP "220.181.111.85" //baidu.com
| |
| SoftwareSerial dbgSerial(10, 11); // RX, TX
| |
| | |
| | |
| void setup()
| |
| {
| |
| // Open serial communications and wait for port to open:
| |
| Serial.begin(57600);
| |
| Serial.setTimeout(5000);
| |
| dbgSerial.begin(9600); //can't be faster than 19200 for softserial
| |
| dbgSerial.println("ESP8266 Demo");
| |
| //test if the module is ready
| |
| Serial.println("AT+RST");
| |
| delay(1000);
| |
| if(Serial.find("ready"))
| |
| {
| |
| dbgSerial.println("Module is ready");
| |
| }
| |
| else
| |
| {
| |
| dbgSerial.println("Module have no response.");
| |
| while(1);
| |
| }
| |
| delay(1000);
| |
| //connect to the wifi
| |
| boolean connected=false;
| |
| for(int i=0;i<5;i++)
| |
| {
| |
| if(connectWiFi())
| |
| {
| |
| connected = true;
| |
| break;
| |
| }
| |
| }
| |
| if (!connected){while(1);}
| |
| delay(5000);
| |
| //print the ip addr
| |
| /*Serial.println("AT+CIFSR");
| |
| dbgSerial.println("ip address:");
| |
| while (Serial.available())
| |
| dbgSerial.write(Serial.read());*/
| |
| //set the single connection mode
| |
| Serial.println("AT+CIPMUX=0");
| |
| }
| |
| | |
| | |
| void loop()
| |
| {
| |
| String cmd = "AT+CIPSTART=\"TCP\",\"";
| |
| cmd += DST_IP;
| |
| cmd += "\",80";
| |
| Serial.println(cmd);
| |
| dbgSerial.println(cmd);
| |
| if(Serial.find("Error")) return;
| |
| cmd = "GET / HTTP/1.0\r\n\r\n";
| |
| Serial.print("AT+CIPSEND=");
| |
| Serial.println(cmd.length());
| |
| if(Serial.find(">"))
| |
| {
| |
| dbgSerial.print(">");
| |
| }else
| |
| {
| |
| Serial.println("AT+CIPCLOSE");
| |
| dbgSerial.println("connect timeout");
| |
| delay(1000);
| |
| return;
| |
| }
| |
| Serial.print(cmd);
| |
| delay(2000);
| |
| //Serial.find("+IPD");
| |
| while (Serial.available())
| |
| {
| |
| char c = Serial.read();
| |
| dbgSerial.write(c);
| |
| if(c=='\r') dbgSerial.print('\n');
| |
| }
| |
| dbgSerial.println("====");
| |
| delay(1000);
| |
| }
| |
| boolean connectWiFi()
| |
| {
| |
| Serial.println("AT+CWMODE=1");
| |
| String cmd="AT+CWJAP=\"";
| |
| cmd+=SSID;
| |
| cmd+="\",\"";
| |
| cmd+=PASS;
| |
| cmd+="\"";
| |
| dbgSerial.println(cmd);
| |
| Serial.println(cmd);
| |
| delay(2000);
| |
| if(Serial.find("OK"))
| |
| {
| |
| dbgSerial.println("OK, Connected to WiFi.");
| |
| return true;
| |
| }else
| |
| {
| |
| dbgSerial.println("Can not connect to the WiFi.");
| |
| return false;
| |
| }
| |
| }
| |
| </pre>
| |
| | |
| ==Arduino Wifi Project==
| |
| | |
| Project is to hook up a tiny LCD to the tiny wifi chip and make a tiny wifi monitor.
| |
| | |
| Add this to the Defcon badge, which should have a microchip that is programmable via serial as well, and could be wired up to control the LCD and tiny wifi chip.
| |
| | |
| Or, just hook it up to the battery or source of power, and have it standalone, running by itself.
| |
| | |
| Inspiration: http://www.seeedstudio.com/wiki/WiFi_Serial_Transceiver_Module
| |
| | |
| LCD Hardware:
| |
| * $15 tiny LCD, 128x128, 4D systems
| |
| ** 4d product page: http://www.4dsystems.com.au/product/4DLCD_144/
| |
| ** mouser: http://www.mouser.com/ProductDetail/4D-Systems/4DLCD-144/?qs=sGAEpiMZZMvrfGaWNM8PuULhtzAtzIIul0nv3rkl5n4%3d
| |
| * round LCD (too expensive)
| |
| ** mouser: round LCDs http://www.mouser.com/search/refine.aspx?Ntk=P_MarCom&Ntt=166384143
| |
| * Large enough to be useful - https://www.adafruit.com/products/1770
| |
| ** 2.8 inch display large enough for tiny drawings, would be perfect.
| |
| | |
| USB-Serial Converter:
| |
| * USB to serial converter:
| |
| ** FTDI provides a usb-serial adapter with a jumper to set the voltage level at 3.3 or 5, depending on what you wanna do:
| |
| ** inspired by this project/page: http://williamdurand.fr/2015/03/17/playing-with-a-esp8266-wifi-module/
| |
| * USB to serial converter, other options:
| |
| ** uart sbee povides BEE connections, like the usb-to-serial BEE boards that I have for the XBees, but these also have 4-pin serial header: http://www.seeedstudio.com/wiki/UartSBee_V4
| |
| | |
| Once you have all those pieces, this page becomes much more useful, and tells you what serial commands to actually run:
| |
| * http://www.esp8266.com/wiki/doku.php?id=getting-started-with-the-esp8266
| |
| | |
| What about the final - logic control from Arduino, USB adapter from 5 V to 3.3 V level, etc.?
| |
| | |
| =Morse Code Generator=
| |
| | |
| This project involves using the building blocks covered above - an LCD scren, the Arduinomorse library, and a piezoelectric speaker - to create a morse code generator with an Arduino Micro.
| |
| | |
| [[Arduino Morse Code Generator]]
| |
| | |
| =More Projects=
| |
| | |
| ==List from Adafruit== | |
| | |
| https://learn.adafruit.com/series/learn-arduino
| |
| | |
| ==RFDuino==
| |
| | |
| https://www.sparkfun.com/products/13209
| |
| | |
| http://www.rfduino.com/shop/index.html
| |
|
| |
|
| =Flags= | | =Flags= |
|
| |
|
| {{ArduinoFlag}} | | {{ArduinoFlag}} |