Powered by Blogger.

Friday, December 2, 2016

Tag: ,

Lesson 7: MagicKits-MagicWiFi




MagicWiFi is the main WiFi module by magicblocks for IoT. This consists of a ESP 8266 12F  module with a USB Serial TTL convertor and an integrated Li-ion Battery charger. It comes on a small form factor and has the I/O pins exposed to 0.1" standard headers. There are multiple plug and play accessory modules for MagicWiFi.

The advantage of the MagicWiFi module over a standard Arduino is that it is tailor made for IoT applications. Inbuilt WiFi connectivity and the default firmware means that it communicates with the cloud without you having to write a single piece of code for the embedded side. If you are more adventurous you can write you own code and flash the firmware to the MagicWiFi module. 

The module comes with its default firmware where it connects seamlessly with the magicblocks.io cloud over WiFi. You will need an internet connection with WiFi (a mobile phone WiFi hotspot will work) to use the module with the magicblocks.io cloud. The MagicWiFI module operates on both WiFi client and Access point modes simultaneously so that the client is used to connect to a WiFi network with internet access to communicate with the cloud and the access point can be used by the user to configure the module.


Step 1: Connecting to the cloud

FL4KNRSIUSM1ADV.MEDIUM
pixel[2]

pixel[5]
WiFi connection with Internet connectivity should be available
  • Power up module from USB or Battery
  • On your PC or phone look for the SSID of the MagicWiFi to appear. This SSID can be customized if you build the firmware and flash it to the module by yourself. Refer Lesson 6 for more details. What you see here is the SSID of the access point mode of the MagicWiFi module
  • Connect to MagicWiFi access point and navigate to http://192.168.4.1/ in your browser
  • Select the WiFi network through which the MagicWiFi should connect to internet from the dropdown menu
  • Enter the password of the WiFi network selected previously
  • Click 'Submit' and you will receive a message 'Access point saved. Restarting....'
After you click 'Submit' the module will restart. This means the MagicWiFi access point to which you are connected will be disconnected automatically. 
After about 10 seconds connect to the SSID of the MagicWiFi module again and navigate to http://192.168.4.1/ again to clarify if the module is connected properly. If so it should indicate 'Connection to <WiFi network name> successful!'

If connection to WiFi is successful, navigate to the Device Manager of your magicblocks account (refresh if already opened) and you should see that the connection is showing a green 'thumbs up' icon.

You can also use the in-built blue LED to get an idea of the connection status of the module with the cloud. Once you power up the module, the LED will be ON. When it connects to the WiFi network it will start blinking. Once it is connected with the cloud platform the LED will turn OFF. If you are using a customized firmware built with the code builder, this can be observed only if the 'Indicate Status' option  is enabled. On the default firmware which comes with the module, this is enabled by default.


wifi

Step 2: Specifications

  • Dimensions: 40mmx 40mm
  • Module: ESP8266
  • 802.11 b/g/n WIFI
  • Integrated 10-bit ADC
  • Interfaces
    • SDIO 2.0, (H)
    • SPI
    • UART
    • I2C
    • I2S
    • IR Remote Control
    • PWM
    • GPIO
    • Integrated TCP/IP protocol stack
  • Magicblocks.io support
  • Ardunio IDE support
  • Single Cell Li-Ion/Li-Poly battery charger
  • USB to Serial Module
  • UART logic converter

Step 3: Add-on Modules

The MagicWiFi module's user friendly layout enables you to build your design with maximum flexibility. 

MagicDIY

Prototype you custom requirement similar to how you would do on a vero board. You can try sensors, LEDs, switches etc. Just plug it in to your MagicWiFi and you are good to go!

FP70QM7IUSLTB3E.MEDIUM
pixel[6]
pixel[7]
MagicRelay
Relay module custom built to work with MagicWiFi. With the relay module you can now control 230V electrical appliances safely
DSC09867_

Step 4: Magicblocks.io Playground


With the magicblocks.io playground you can use the functions of the MagicWiFi module

  • Digital Input - Read the value of a digital pin as 1 or 0
  • Analog input - Sample the value at the ADC pin and return
  • Digital output - Write to a digital pin as 1 or 0
  • PWM output - provide a PWM output to a specific pin. Can be used for motor control
  • Service motor control - connect a servo motor and provide the signal to control the angle of the motor shaft
  • Serial RX/TX - Read any device connected to the TX0, RX0 pins of the MagicWiFi at 115200 baud
  • NFC read - When connected with a PN532 NFC reader module, this block will trigger the NFC card tap event with the UID of the card.
More on this can be found in the node documentation here