User Tools

Site Tools


yun_reset

YUN Topics

Once you’ve connected to your Arduino’s WiFi, open a browser and visit arduino.local.
If that doesn’t work, visit 192.168.240.1.
When asked for a password, enter “arduino”

YunSerialTerminal

One difference is that to enable public key based authentication for root, the authorized public keys need to be
 added to the following file (and not the usual /root/.ssh/authorized_keys):

vi /etc/dropbear/authorized_keys
chmod 0600 /etc/dropbear/authorized_keys

A complete tutorial for setting up public key based authentication on OpenWRT can be found here.

UNIX examples - many hacks

OSX Fuse - SSHFS

YUN websockets server

Yaler Example

Websockets Client

Download libwebsockets:

https://www.dropbox.com/s/r4lx1etrdaadc3o/libwebsockets_2014-03-01-388dc7d201d8d123841869fb49ec4d94d6dd7f54_ar71xx.ipk?dl=0

Download libwebsockets-examples:

https://www.dropbox.com/s/yt55xof23nte802/libwebsockets-examples_2014-03-01-388dc7d201d8d123841869fb49ec4d94d6dd7f54_ar71xx.ipk?dl=0

Dev Tools on YUN

Dev Tools and Web Server Hacks

Extending Disk Space

Insert a microSD card and run the Expanding Space sketch
Install binutils so you have a linker, without this gcc is pretty useless

opkg update
opkg install binutils


Install make if you plan on using Makefiles

opkg install make


Install the yun-gcc package using a cached location for the downloaded file, this can take 15 to 20 minutes so be patient:

opkg -t /root install yun-gcc

Reset Password

So the problem is that you've lost your password?
Two workarounds:


    start the yun and wait a minute, load the yunserialterminal example, 
    open the serial monitor, press enter and see the prompt, type "passwd" 
    without the double quotes and change your password

    start the yun and wait a minute, the press and hold the reset button for 
    about 40 seconds (it's on the side, near the USB connector)
    

packages

oot@showcontroller:~# df -k
Filesystem           1K-blocks      Used Available Use% Mounted on
rootfs                    7168      3336      3832  47% /
/dev/root                 7680      7680         0 100% /rom
tmpfs                    30560       148     30412   0% /tmp
tmpfs                      512         0       512   0% /dev
/dev/mtdblock3            7168      3336      3832  47% /overlay
overlayfs:/overlay        7168      3336      3832  47% /
root@showcontroller:~# opkg install ./libwebsocket-examples.ipk
Installing libwebsockets-examples (2014-03-01-388dc7d201d8d123841869fb49ec4d94d6dd7f54) to root...

Bridge Library and Examples

run-sysupgrade /mnt/sda1/openwrt-ar71xx-generic-yun-16M-squashfs-sysupgrade.bin

The output on the console will look like this:

run-sysupgrade /mnt/sda1/openwrt-ar71xx-generic-yun-16M-squashfs-sysupgrade.bin
Sending TERM to remaining processes ... uhttpd dbus-daemon dnsmasq avahi-daemon thd ntpd uSDaemon sleep syslogd klogd hotplug2 procd ubusd netifd
Sending KILL to remaining processes ...
Switching to ramdisk...
Performing system upgrade...
Unlocking firmware ...

Writing from <stdin> to firmware ...    
Upgrade completed
Rebooting system...
name seems to be in /tmp/resolv.conf.auto
nameserver <gateway router> such as 192.168.1.1
opkg intsall sqlite3-cli


Install php5-mod-sqlite3 - 5.4.17-1, And of cource the other PHP modules you need

Example php5

     db=new SQLite3("/mnt/sda1/arduino/www/test/ec.db");
     $results = $db->query('SELECT * FROM Navn');
     while ($row = $results->fetchArray()) {
     var_dump($row);
     print $row[1];
     }
You need to edit uhttpd (the web server) config file, located at /etc/config/uhttpd . 

HP (5 or 4)

In order to install php5 or php4, be sure your Yún can access the internet then, via SSH or via the YunSerialTerminal, issue commands

opkg update
opkg install php5 php5-cgi

Php5-cgi is good for making web sites. If you want to use php as a command line interpreter, install php5-cli

Ensure that you uncomment the extension interpreter line for PHP in the main section of the uHTTPd config file: list interpreter ".php=/usr/bin/php-cgi" 
Creating keys on the Yun:

dropbearkey -t rsa -f id_rsa

Viewing the keys: 

dropbearkey -f ./id_rsa -y

Connecting using the key:

 ssh -i ./id_rsa <address>

Need to copy the ~/.ssh/known_hosts to /.ssh for automated startup scripts to work with SSH and SCP

Sketch Uploader

Building with Makefile

Run avrdude

The sketch will be transferred to the AR9331,
and the Linux distribution will program the ATmega32U4 
through the SPI bus, emulating an AVR ISP programmer.
The "/arduino" directory doesn't have anything pre-configured. Anything added to the URL after the end point is passed from the webserver to the sketch on the 32U4. You can define your APIs inside the sketch. See the Bridge example to see how this is done to access the pins on the board.

"/data" is used to access to the internal key/value storage. The available calls are:

    /put/KEY/VALUE : stores a value inside the storage
    /get/KEY : obtains the value of the requested key in JSON
    /get : obtains the entire storage list in JSON.
    /delete : deletes the internal storage 


"mailbox" is used to add messages into a queue called Mailbox. The message queue is stored inside the Linux system and can be read by the Arduino microcontroller. The available REST call is:

    "/mailbox/message" 
Time working in PHP
ssue commands

opkg update
opkg install zoneinfo-core
opkg install zoneinfo-europe
opkg install zoneinfo-northamerica

Type opkg list | grep zoneinfo and look for your timezone 

Still has Warnings - remove warnings:
error_reporting(E_ERROR | E_PARSE);
MOD CURL

opkg install php5-mod-curl
Installing php5-mod-curl (5.4.5-3) to root...
yun_reset.txt · Last modified: 2021/06/04 02:16 (external edit)