rwaldron / nino-io

Linino One & Arduino Yun IO Plugin for Johnny-Five
http://johnny-five.io
MIT License
8 stars 2 forks source link

Do Arduino Yun need LininoIO and Ideino to upload Johnny-five files? #4

Closed aabm00 closed 8 years ago

aabm00 commented 9 years ago

Hello I'm new programming with Arduino. I got an Arduino Yun, and I want to use it to read from sensors and send the data via wifi to a node server using johnny-five. I started to configure the board but I have some doubts that I would appreciate some help. This is the process that I have followed to install johnny-five following the instruction in nino-io:

var five = require("johnny-five");
var Nino = require("nino-io");
var board = new five.Board({
  io: new Nino({
    layout: "Arduino Yun"
  })
});

board.on("ready", function() {
  console.log("Ready");

  var led = new five.Led(13);

  led.blink(500);
});

And the doubts are:

  1. How I upload this code to the board? The Arduino IDE doesn’t work.
  2. Do I need to install Ideino IDE & Linino-Lib to upload to code?
  3. If I need Ideino IDE, it needs lininoIO to work, then, Do I need to install lininoIO?
  4. The installation of lininoIO isn’t trivial and there are the risk to break the board and that will VOID the WARRANTY of the Yún. Is it necessary to install lininoIO and update the U-boot, firmware, kernel, rootfs and MCU firmware to LininoIO version?
  5. Is there an easy way to do it?

Thanks

rwaldron commented 9 years ago

I've never successfully upgraded a Yun to LininoOS. I've reached out to the DogHunter team for help and was basically told that I did it wrong and that it should work—I bricked 3 Yuns (when I say "bricked", I mean they don't respond to anything anymore). I've been told there are Yuns that ship with LininoOS/LininoIO factory flashed—I've never seen one.

  1. Is there an easy way to do it?

I wish :(

I think I should probably remove "Yun" from mention in this repo. Currently, it's not listed on http://johnny-five.io/platform-support/

If you live in the US, you may email me your shipping address and I will send you a Linino One + Add-ons.

aabm00 commented 9 years ago

I thought that you were successful because of your answer to this issue and the nino.io. . I suppose the question now would be. Can I use Johnny-five in a Yun in another way? I mean forgetting LininoOS and reinstalling OpenWRT-Yun. Said that, I don’t know if after made the steps above mentioned (my last post) I can come back and reinstall the OpenWRT-Yun. Thanks for your offer but I live in Spain.

rwaldron commented 9 years ago

Sorry, that was advice that assumed the installed went correctly—because according to devs at DogHunter, it should work.

Can I use Johnny-five in a Yun in another way? I mean forgetting LininoOS and reinstalling OpenWRT-Yun.

@LegendaryTom wrote upi this: http://htmlpreview.github.io/?https://gist.github.com/LegendaryTom/d0bf1a384b10e3f8547b/raw/

aabm00 commented 9 years ago

Sorry, I probably didn’t explain very well.

After expand the Yun, the upgrade from openWRT-Yun to LininoOS was successful. Then installed node.js, and finally nino-io and johnnny-five and stopped here because of the doubts. I thought for your answer, that your Yun bricked, not during the upgrade from openWRT-Yun to LininoOS but in the installation of LininoIO and the consequent update of the U-boot, firmware, kernel, rootfs, and MCU firmware to LininoIO. But after looking at the link of @LegendaryTom I would have to update U-boot, firmware, kernel, rootfs, too.

The main doubt is if I need to install LininoIO to work with Johnny-five.

If your answer is Yes probably it would be worth to try to update U-boot, firmware, kernel, rootfs, and MCU firmware to LininoIO, with the LininoOS. wouldn’t it?

Thanks.

rwaldron commented 9 years ago

After expand the Yun, the upgrade from openWRT-Yun to LininoOS was successful. Then installed node.js, and finally nino-io and johnnny-five and stopped here because of the doubts

I'm very confused now. Have you tried running any JS programs yet?

aabm00 commented 9 years ago

Sorry for the delay in replying. I tried to execute the blink code (see above in my first post) in the board inside the /opt directory and get that:

BusyBox v1.19.4 (2015-03-04 21:53:53 CET) built-in shell (ash) Enter 'help' for a list of built-in commands.

      ___                   ___                       ___           ___
     /\__\      ___        /\__\          ___        /\__\         /\  \
    /:/  /     /\  \      /::|  |        /\  \      /::|  |       /::\  \
   /:/  /      \:\  \    /:|:|  |        \:\  \    /:|:|  |      /:/\:\  \
  /:/  /       /::\__\  /:/|:|  |__      /::\__\  /:/|:|  |__   /:/  \:\  \
 /:/__/     __/:/\/__/ /:/ |:| /\__\  __/:/\/__/ /:/ |:| /\__\ /:/__/ \:\__\
 \:\  \    /\/:/  /    \/__|:|/:/  / /\/:/  /    \/__|:|/:/  / \:\  \ /:/  /
  \:\  \   \::/__/         |:/:/  /  \::/__/         |:/:/  /   \:\  /:/  /
   \:\  \   \:\__\         |::/  /    \:\__\         |::/  /     \:\/:/  /
    \:\__\   \/__/         /:/  /      \/__/         /:/  /       \::/  /
     \/__/                 \/__/                     \/__/         \/__/

            _______                     ________        __
           |       |.-----.-----.-----.|  |  |  |.----.|  |_
           |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
           |_______||   __|_____|__|__||________||__|  |____|
                    |__| W I R E L E S S   F R E E D O M

root@ofcyun:~# cd /opt
root@ofcyun:/opt# node strobe_yun.js
1431880673331 Device(s) Arduino Yun
Failed to export PWM: (ENOENT ENOENT, open '/sys/class/pwm/pwmchip0/export') { ENA: true,
  DEF: 'D3',
  TYP: 'digital',
  NUM: '116',
  MAP: 'D3',
  servo: null,
  pwm:
   { ENA: true,
     DEF: 'P3',
     TYP: 'pwm',
     MAP: 'D3',
     BIT: '8',
     NUM: '0',
     TIM: { DEF: 'T0', SET: false, USE: [], SHARED: false },
     MAX: 4000000,
     RES: 15625 } }
Failed to export PWM: (ENOENT ENOENT, open '/sys/class/pwm/pwmchip0/export') { ENA: true,
  DEF: 'D5',
  TYP: 'digital',
  NUM: '114',
  MAP: 'D5',
  servo:
   { ENA: true,
     DEF: 'P5',
     TYP: 'pwm',
     MAP: 'D5',
     BIT: '16',
     NUM: '4',
     TIM: { DEF: 'T1', SET: false, USE: [], SHARED: false },
     MAX: 32768000,
     RES: 500 },
  pwm:
   { ENA: true,
     DEF: 'P5',
     TYP: 'pwm',
     MAP: 'D5',
     BIT: '16',
     NUM: '4',
     TIM: { DEF: 'T1', SET: false, USE: [], SHARED: false },
     MAX: 32768000,
     RES: 500 } }
Failed to export PWM: (ENOENT ENOENT, open '/sys/class/pwm/pwmchip0/export') { ENA: true,
  DEF: 'D6',
  TYP: 'digital',
  NUM: '123',
  MAP: 'D6',
  servo: null,
  pwm:
   { ENA: true,
     DEF: 'P6',
     TYP: 'pwm',
     MAP: 'D6',
     BIT: '16',
     NUM: '5',
     TIM: { DEF: 'T2', SET: false, USE: [], SHARED: false },
     MAX: 16384000,
     RES: 64000 } }
Failed to export PWM: (ENOENT ENOENT, open '/sys/class/pwm/pwmchip0/export') { ENA: true,
  DEF: 'D9',
  TYP: 'digital',
  NUM: '105',
  MAP: 'D9',
  servo:
   { ENA: true,
     DEF: 'P9',
     TYP: 'pwm',
     MAP: 'D9',
     BIT: '16',
     NUM: '1',
     TIM: { DEF: 'T3', SET: false, USE: [], SHARED: true },
     MAX: 32768000,
     RES: 500 },
  pwm:
   { ENA: true,
     DEF: 'P9',
     TYP: 'pwm',
     MAP: 'D9',
     BIT: '16',
     NUM: '1',
     TIM: { DEF: 'T3', SET: false, USE: [], SHARED: true },
     MAX: 32768000,
     RES: 500 } }
Failed to export PWM: (ENOENT ENOENT, open '/sys/class/pwm/pwmchip0/export') { ENA: true,
  DEF: 'D10',
  TYP: 'digital',
  NUM: '106',
  MAP: 'D10',
  servo:
   { ENA: true,
     DEF: 'P10',
     TYP: 'pwm',
     MAP: 'D10',
     BIT: '16',
     NUM: '2',
     TIM: { DEF: 'T3', SET: false, USE: [], SHARED: true },
     MAX: 32768000,
     RES: 500 },
  pwm:
   { ENA: true,
     DEF: 'P10',
     TYP: 'pwm',
     MAP: 'D10',
     BIT: '16',
     NUM: '2',
     TIM: { DEF: 'T3', SET: false, USE: [], SHARED: true },
     MAX: 32768000,
     RES: 500 } }
Failed to export PWM: (ENOENT ENOENT, open '/sys/class/pwm/pwmchip0/export') { ENA: true,
  DEF: 'D11',
  TYP: 'digital',
  NUM: '107',
  MAP: 'D11',
  servo:
   { ENA: true,
     DEF: 'P11',
     TYP: 'pwm',
     MAP: 'D11',
     BIT: '16',
     NUM: '3',
     TIM: { DEF: 'T3', SET: false, USE: [], SHARED: true },
     MAX: 32768000,
     RES: 500 },
  pwm:
   { ENA: true,
     DEF: 'P11',
     TYP: 'pwm',
     MAP: 'D11',
     BIT: '16',
     NUM: '3',
     TIM: { DEF: 'T3', SET: false, USE: [], SHARED: true },
     MAX: 32768000,
     RES: 500 } }
Failed to export ADC: (ENOENT ENOENT, open '/sys/bus/iio/devices/iio:device0/enable')
1431880673932 Connected Arduino Yun
1431880674047 Repl Initialized
>> Ready

TypeError: Cannot call method 'includes' of undefined
    at Pins.(anonymous function) [as isPwm] (/opt/node_modules/johnny-five/lib/board.pins.js:239:39)
    at Led.Controllers.DEFAULT.initialize.value (/opt/node_modules/johnny-five/lib/led/led.js:100:30)
    at new Led (/opt/node_modules/johnny-five/lib/led/led.js:223:10)
    at Board.<anonymous> (/opt/strobe_yun.js:13:13)
    at Board.EventEmitter.emit (events.js:92:17)
    at process._tickCallback (node.js:415:13)
root@ofcyun:/opt#

So I thought I had to install LininoIO, so I followed the instructionns in the web upgradetolininoio and for upgrade uboot, kernel, rootfs I followed this other yhat is better explained flash-from-uboot except the step ART (Atheros calibration raw file ). Using this files: o openwrt-ar71xx-generic-linino-u-boot.bin o openwrt-ar71xx-generic-linino-yun-16M-kernel.bin o openwrt-ar71xx-generic-linino-yun-16M-rootfs-squashfs.bin

It was Ok. Then I followed the steps to install lininoIO: cd /tmp wget http://download.linino.org/linino_distro/lininoIO/latest/lininoIO-generic-linino-yun-squashfs-sysupgrade.bin sysupgrade -n -v lininoIO-generic-linino-yun-squashfs-sysupgrade.bin

But after that, I can't access via SHH to my board through the "YunSerialTerminal", I can't see anything. I have lost the Yun Password after sysupgrade and I can't recover it introducing it again through the "passwd" instruction in the "YunSerialTerminal", and consequently I can access the yun via puTTY either. The USB LED, never lights now, even though it appears in the port in the Arduino IDE, and the RX LED is always blinking.

So I think I have bricked My Yun.

Some Idea !!!!

Thanks

aabm00 commented 9 years ago

If it helps, when I reset the Yun through the YunSerialTerminal the restart doesn't finish and I lost access to the yun via port serial (COM). To recover I have to unplug the USB and plug again. That's I get;

U-Boot 1.1.4-linino-g335e76c8-dirty (Mar  5 2015 - 09:56:20)

Linino Board (ar9331) U-boot
DRAM:  64 MB
Top of RAM usable for U-Boot at: 84000000
Reserving 217k for U-Boot at: 83fc8000
Reserving 192k for malloc() at: 83f98000
Reserving 44 Bytes for Board Info at: 83f97fd4
Reserving 36 Bytes for Global Data at: 83f97fb0
Reserving 128k for boot params() at: 83f77fb0
Stack Pointer at: 83f77f98
Now running in RAM - U-Boot at: 83fc8000
Flash Manuf Id 0xef, DeviceId0 0x40, DeviceId1 0x18
flash size 16777216, sector count = 256
Flash: 16 MB
In:    serial
Out:   serial
Err:   serial
Net:   eth0: b4:21:8a:00:00:00
eth1: b4:21:8a:00:00:01
eth0, eth1
autoboot in 4 seconds (stop with 'lin')...
## Booting image at 9fea0000 ...
   Image Name:   MIPS OpenWrt Linux-3.3.8
   Created:      2015-02-03  14:03:09 UTC
   Image Type:   MIPS Linux Kernel Image (lzma compressed)
   Data Size:    1129750 Bytes =  1.1 MB
   Load Address: 80060000
   Entry Point:  80060000
   Verifying Checksum at 0x9fea0040 ...OK
   Uncompressing Kernel Image ... OK
No initrd
## Transferring control to Linux (at address 80060000) ...
## Giving linux memsize in bytes, 67108864

Starting kernel ...

[    0.000000] Linux version 3.3.8 (build@build-base) (gcc version 4.6.3 20120201 (prerelease) (Linaro GCC 4.6-2012.02) ) #1 Tue Feb 3 15:02:42 CET 2015
[    0.000000] bootconsole [early0] enabled
[    0.000000] CPU revision is: 00019374 (MIPS 24Kc)
[    0.000000] SoC: Atheros AR9330 rev 1
[    0.000000] Clocks: CPU:400.000MHz, DDR:400.000MHz, AHB:200.000MHz, Ref:25.000MHz
[    0.000000] Determined physical RAM map:
[    0.000000]  memory: 04000000 @ 00000000 (usable)
[    0.000000] User-defined physical RAM map:
[    0.000000]  memory: 04000000 @ 00000000 (usable)
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] Zone PFN ranges:
[    0.000000]   Normal   0x00000000 -> 0x00004000
[    0.000000] Movable zone start PFN for each node
[    0.000000] Early memory PFN ranges
[    0.000000]     0: 0x00000000 -> 0x00004000
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 16256
[    0.000000] Kernel command line:  console=spicons board=linino-yun mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env),14656k(rootfs),1280k(kernel),64k(nvram),64k(art),15936k@0x50000(firmware) mem=64M rootfstype=squashfs,jffs2 noinitrd rootfstype=squashfs,jffs2 noinitrd
[    0.000000] PID hash table entries: 256 (order: -2, 1024 bytes)
[    0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
[    0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.
[    0.000000] Primary data cache 32kB, 4-way, VIPT, cache aliases, linesize 32 bytes
[    0.000000] Writing ErrCtl register=00000000
[    0.000000] Readback ErrCtl register=00000000
[    0.000000] Memory: 61004k/65536k available (2416k kernel code, 4532k reserved, 686k data, 216k init, 0k highmem)
[    0.000000] SLUB: Genslabs=9, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS:256
[    0.000000] Calibrating delay loop... 265.42 BogoMIPS (lpj=1327104)
[    0.080000] pid_max: default: 32768 minimum: 301
[    0.080000] Mount-cache hash table entries: 512
[    0.080000] NET: Registered protocol family 16
[    0.090000] gpiochip_add: registered GPIOs 0 to 29 on device: ath79
[    0.090000] MIPS: machine is Arduino Yun
[    0.530000] mach-linino: setting GPIO
[    0.530000] Setting GPIO OE 21
[    0.540000] Setting GPIO OE2 22
[    0.540000] Setting GPIO UART-ENA 23
[    0.540000] mach-linino: enabling GPIO SPI Controller
[    0.550000] bio: create slab <bio-0> at 0
[    0.560000] Switching to clocksource MIPS
[    0.570000] NET: Registered protocol family 2
[    0.570000] IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.570000] TCP established hash table entries: 2048 (order: 2, 16384 bytes)
[    0.570000] TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
[    0.570000] TCP: Hash tables configured (established 2048 bind 2048)
[    0.570000] TCP reno registered
[    0.570000] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.580000] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.580000] NET: Registered protocol family 1
[    0.600000] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.600000] JFFS2 version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.610000] msgmni has been set to 119
[    0.610000] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 253)
[    0.610000] io scheduler noop registered
[    0.620000] io scheduler deadline registered (default)
[    0.620000] Serial: 8250/16550 driver, 16 ports, IRQ sharing enabled
[    0.630000] ar933x-uart: ttyATH0 at MMIO 0x18020000 (irq = 11) is a AR933X UART
[    0.630000] console [spicons0] enabled, bootconsole disabled
aabm00 commented 9 years ago

At the end I could install:

The problem was that after the "sysupgrade" the board sets the linino defaults for the Name = "linino" and Password = 'doghunter' of the Yun. Then I could access via ssh and finish the installation.

Now my problem is that I can't access the board via the serial port (COM), In the Arduino IDE in tools --> port --> doesn't appear.

Some Idea how to fix that?

Thanks

rwaldron commented 9 years ago

So I think I have bricked My Yun.

Looks like you did the same thing that I did when I bricked mine.

Now my problem is that I can't access the board via the serial port (COM), In the Arduino IDE in tools -> port --> doesn't appear.

Some Idea how to fix that?

I have no idea :(

I'm very sorry about this, but I've never been able to get helpful responses from the devs at DogHunter.

aabm00 commented 9 years ago

I solved the problem of the Serial PORT following the instructions here, and now I'm going to test if Johnny-five works and I would appreciate a lot if you could answer the next questions:

  1. To install nino-io & Johnny-five in the Yun with LininoOS, Is it necessary install LininoIO?
  2. After install node.js the files structure under the /opt folder is:

/opt
/lost+found
/usr __/bin __/etc __/lib ____ /nodemodules ____/opkg

I guess that I have to run npm install nino-io johnny-five under /opt/usr/lib. Am I right?

Thanks

rwaldron commented 9 years ago

To install nino-io & Johnny-five in the Yun with LininoOS, Is it necessary install LininoIO?

When I set mine up, I had to install LininoIO. I'm not sure if that's changed or not.

I guess that I have to run npm install nino-io johnny-five under /opt/usr/lib. Am I right?

I've had it installed like this:

/opt /my-project-files __index.js (or whatever you want to call yours /node_modules

I want to make sure that you know how much I appreciate your patience working through this installation. @frxnz and I had both given up on the Yun, so I'm beyond thrilled to see that you've pushed through to success. Again, I apologize for being very little help in this process—you are a true champion :)

derekwheee commented 9 years ago

This has almost inspired me to give Yun another chance. Almost :smile:

Would love to see a consolidated writeup on getting everything to work once you've got it figured out.

rwaldron commented 9 years ago

This has almost inspired me to give Yun another chance. Almost

Same here :)

aabm00 commented 9 years ago

It would have been very nice to find the holy grail, but after my Yun have revived some times,I think this time is going to be very difficult.

I tried to make a proof and edited the /etc/inittab file commenting the last line:

::sysinit:/etc/init.d/rcS S boot ::shutdown:/etc/init.d/rcS K shutdown

ttySPI0::respawn:/bin/ash --login

And now I have neither wifi, nor ethernet, nor YunSerialTerminal access, only access via Serial port COM. The WLAN reset for 30 seconds doesn't work, and I can't get the 'failsave mode' through YunSerialTerminal, so I can't restore the inittab file.

So I'm very sorry, but I think my time for the 'YUN' is going to finish, at least for a while, because I need to advance the project so I need your advise.

As I explained, I'm new programming with Arduino. I want to program in Javascript with J5, and my project is related with read from sensors (pressure, temperature, etc from machines ), and send the data via wifi to a node.js server.

I thought that Arduino Yun was a good option because he has Wifi, ethernet, and Linux. But now I would like your advise of another board with the same or similar performance and with no problems configuring j5.

Thanks for your support and it would be nice that you both give to the Yun another oportunity. I'll do it