Control Rapiro with Mobile phone Introduction

rapiro

Rapiro is a cute, affordable, and easy to assemble humanoid robot kit.  Rapiro comes with an Arduino compatible controller board, and you can reprogram Rapiro with Arduino IDE easily.   One of the coolest feature is that you can extend Rapiro‘s functionality by connecting other components to enhance Rapiro’s capabilities.

“Its limitless possibilities all depend on you.”

This time, I will show you how to control Rapiro with IOS devices through BLE connection. I will divide this tutorial in two parts.

First will show you how to connect Rapiro to RedBearLab’s BLE Nano Board, and run a simple test code to confirm the connection.

Then in the second part of tutorial, I will show you how to connect and turn your IOS devices into a remote control and to control Rapiro‘s action.

Parts Need:

  1. Rapiro
  2. RedBearLab BLE Nano & MK20 USB Board (only need BLE Nano, but need USB Board to program the chip)
  3. Four Female/Male Jumper Wires
  4. IOS device

Software

  1. Arduino IDE 1.5.7 or later
  2. Xcode (for IOS Development, and you must be a registered IOS Developer in order to run the program on your IOS device)
  3. RedBearLab nRF51822-Arduino (Add support to your Arduino IDE for compiling nRF51822 firnware

Tutorial

Part 1: Connect RedBearLab BLE Nano to Rapiro

Part 2: Using IOS device to control your Rapiro through RedBearLab BLE Nano

Optional: Control Rapiro with Evothings Client

Quick Guide!

 

Read More

Parse Server, Live Query and AWS LB

Today my partner has problem to create connection for Live Query to an AWS server deploy with Elastic Beanstalk, so I have to see why he is not able to start a websocket connection.

Currently, that Parse Server is running on a EC2 instance within a VPC, with an iptable routing request from AWS LB to Nginx.

My partner has tried couple things.  Switch from AWS classic LB to Application LB, and also enable stickiness on the request.  However, he was still stuck.

After Google like everyone do, I found that  “NGINX supports WebSocket by allowing a tunnel to be set up between a client and a backend server. For NGINX to send the Upgrade request from the client to the backend server, the Upgrade and Connection headers must be set explicitly

The setting is simple, I just added those header in Nginx configuration file, and Live Query Setting is working!

 

For more information how to upgrade request, this is the link:

https://www.nginx.com/blog/websocket-nginx/

Read More

Magento redirect route in Custom Module and Observer

I was asked to redirect all routes(except admin) in Magento 1.9.2 to a custom module‘s frontend.  With Observer pattern, it is very easy to achieve it.

In Magento, when the front page layout beginning to display, an event “controller_front_send_response_before” will occur, and we will subscribe to this event to trigger our function for redirection.

To subscribe to this event, add the following xml tags in etc/config.xml in our custom module directory in the global tag.

This is what I guess the meaning of this xml tag, but I may be wrong: Magento will use singleton method, get model observer, and call customRedirect() function.  (e.g. Mage::getSingleton(‘custom_module/observer’)->customRedirect() )

Since we will need a new model “Observer”, in our custom module directory, under Model folder, create a file call “Observer.php”.

In customeRedirect() function, my code will check if this is admin path, or custommodule path.  If pattern does not match, it will redirect to custommodule route.

if you want to redirect to HTTPS route, you will need to provide the second parameter in setRedirect function like this:

setRedirect(Mage::getUrl(“customemodule/index/index”, array(‘_forced_secure’ => true);

 

 

Read More

Magento 1.9.2 Custom order amount in dashboard

A module I am building which will create a custom order, and everything is ok until I found that the Grand Total was not showing up Last 5 orders in Dashboard.

dashboard

Google again, and I found that there is a property in Order Model must be set in sales_flat_order table. base_to_global_rate must set to 1.0 (I am not sure what the value meant, but 1.0 is the value that when place order normally)

Also, another problem is create custom order and I called setShippingMethod to ‘flatrate_flatrate’, in Order View it did not show up flatrate.

flatrate

Google around again, and I found that I must set Shipping Description in the order, and now it works!

flatrate2

I have embed the Snippet from my code in Gist.

Read More