Connecting the Core to the Arduino Nano

@Domino, read my comment on kickstarter concerning this forum and the need for beginner tutorials.

I ordered three extra Cores… Now is see in the Core pinout http://domino.io/docs/hardware/src/Domino-Core-Pinout.pdf that tx/rx of the UART is directly beside the power supply and the 150mA 3.3 Volt (= 0.5 Watt) of the Arduino Nano should be able to power the Core.
As i will need anlaog Inputs anyway, easiest way to work with the Core might be soldering a ribbon cable to Core pins 20 to 25 (rx,tx,gnd,2.5V ref,3.3V Flash in, 3.3V Core in) and a male header for the Nano-side.
I think, UART communicaton is done by pulling high to low. Therefore, a nice 3mm led for Core-rx should block the 5V Nano-tx yet allowing the Nano to communicate with the Core (i do that with the ESP82665-05). Don’t yet know to turn the 2.5Volt Core-tx into the 5Volt Nano-rx. Maybe a 2Volt Zener-Diode might do - ideas welcome.

The Luci webconsole is written in Lua, so Lua should be fine to code IoT. The NodeMCU examples might work out of the box !

Sending a message to serial port of openWRT using Lua:
http://www.ediy.com.my/index.php/blog/item/40-send-message-to-serial-port-or-router-using-lua

Coding the serial communicaton on the Arduino side with “Serial.begin(9600);” and “Serial.print(…)” as well as “Serial.available()” should be no problem.

Ssh from Xubunto to the Domino Pi (both my laptop and the Pi are connected my Android hotspot):

verlierer@ewigerWinter:~$ ssh root@192.168.43.86
root@192.168.43.86's password: 

BusyBox v1.22.1 (2015-06-12 16:41:57 HKT) built-in shell (ash)
Enter 'help' for a list of built-in commands.
              _____                        _                 
             |  __ \                      (_)                
             | |  | |   ___    _ __ ___    _   _ __     ___  
             | |  | |  / _ \  | '_ 

_ \ | | | '_ \ / _ \
| || | | () | | | | | | | | | | | | | | () |
|
/ _/ || || || || || || __/
OpenWrt Wireless Freedom
root@domino:/# cd /dev
root@domino:/dev# ls tty*
tty ttyS0 ttyS10 ttyS12 ttyS14 ttyS2 ttyS4 ttyS6 ttyS8
ttyATH0 ttyS1 ttyS11 ttyS13 ttyS15 ttyS3 ttyS5 ttyS7 ttyS9
root@domino:/dev# lua
Lua 5.1.5 Copyright (C) 1994-2012 Lua.org, PUC-Rio (double int32)
> io.output(“/dev/ttyS0”)
> io.write(“losing liberates\r”)
> os.exit()
root@domino:/dev#
`

I could connect my DSONanoV2 - (Pocket-Sized Digital Oscilloscope) to the Core-TX and try all the possible ttys.

But someone might like to help me :slight_smile:

Roland
the born loser
you either lose… or fail !

/dev/ttyATH0 is the UART (at least on the Pi headers)
Wrote a small lua script to scan all tty ports. Connected a led with 680 ohms to Pi-Tx and voilá, a bright flash when lua was writing to /dev/ttyATH0

If i remember correctly:

xubuntu console
ssh root@192.168.43.86
cd /www/cgi-bin
cat > serial.lua
strg + d
chmod 0777 serial.lua

Than using the editor from the domino web interface:

#!/usr/bin/lua

function scandir(directory)
local i, t, popen = 0, {}, io.popen
for filename in popen('ls -a '…directory):lines() do
i = i + 1
t[i] = filename
end
return t
end

print(“Content-Type: text/html”)
print(“”)
print(“<!DOCTYPE html>”)
print(“the Roland…<br>”)

local a = scandir(“/dev/tty*”)
for i,s in pairs(a) do
h = io.open(s,“w”)
if h then
print (s … " …<br>“)
io.flush()
local i = os.time()
while os.time() <= i+2 do
h:write(“Who loses every day will live on forever…\r”)
end
h:flush()
h:close()
else
print (s … " failed :-(<br>”)
end
end

call script in browser: http://192.168.43.86/cgi-bin/serial.lua

the Roland…
/dev/tty failed :frowning:
/dev/ttyATH0 …
/dev/ttyS0 …
/dev/ttyS1 …
/dev/ttyS10 …
/dev/ttyS11 …
/dev/ttyS12 …
/dev/ttyS13 …
/dev/ttyS14 …
/dev/ttyS15 …
/dev/ttyS2 …
/dev/ttyS3 …
/dev/ttyS4 …
/dev/ttyS5 …
/dev/ttyS6 …
/dev/ttyS7 …
/dev/ttyS8 …
/dev/ttyS9 …

And right at the beginning the led goes on :slight_smile:

i used tx to pull +3.3 Volt to GND. This confirmes that communication is done by pulling hi to low.
So instead of connecting the led to +3.3V but to an 3.3V Arduino Mini, communication should work.
For a 5V Arduino, just one led would still lett 4.3V onto Pi-Tx. Creators said this would kill the Core.
But a 2.5 Zener-Diode should indeed do the job ?

The Roland
Ideas welcome

PS. this forum editor is one of worst i have seen in the last 10 years. No preview, no wysiwg.
Just trying the code with the pre-tag instead of code-tag:

function scandir(directory)
    local i, t, popen = 0, {}, io.popen
    for filename in popen('ls -a '..directory):lines() do
        i = i + 1
        t[i] = filename
    end
    return t
end

the code-button is not very reliable. testing with code-button

function scandir(directory)
    local i, t, popen = 0, {}, io.popen
    for filename in popen('ls -a '..directory):lines() do
        i = i + 1
        t[i] = filename

    end
    return t
end

just have seen at domino.io/docs/pi/serial.html that we can directly attach the cheap usb-uart-dongles to Core-tx and Core-rx:

5V to Core-rx ?

That would be 5V to GPIO9 (pin 20) which is said to max take 2.9 Volt: domino.io/docs/hardware/src/Domino-Core-Pinout.pdf

Creators ???

Hi @loser, I read your comments in KS and I am trying to follow you…

The USB-UART adapter is 3.3V instead of 5V. Also there is a resistor on RX for protection purpose.

You can edit your post within some minutes after you post. Yes, bbpress is not good, except that it is integrated.

still no beginner tutorials :-/

still need a new wireless platform with analog input :-/

by now i have some Arduino Mini 3.3Volts here…

And quickly found a post about sending serial data from Arduino to openWrt: www.hackup.net/2011/09/serial-communication-between-an-arduino-and-the-tl-mr3220-router
the roland,
Ideas welcome.

Yes, $10 reward (via paypal) for a “domino core/Pi to Arduino Mini/Nano”-tutorial showing how to read an analog input and setting a digital output from a lua script running on the Core with only the tx/rx (3.3V, GND) serial connection.

Put that little blink+serial program from Serial Communication Between an Arduino and the TL-MR3220 Router on my arduino mini pro 3.3V

Arduino’s serial monitor shows the output :slight_smile:

Then i connected tx/rx/gnd to that lan-tile of the Domino…

Was able to install “screen” on the Core :slight_smile:

indeed i had tocomment the last line out in /etc/inittab :

::sysinit:/etc/init.d/rcS S boot
::shutdown:/etc/init.d/rcS K shutdown
# Disabled serial console.
#ttyS0::askfirst:/bin/ash --login

then i get

root@domino:/dev# screen /dev/ttyATH0 9600
/var/run/utmp: No such file or directory
Turn #120
LED ON
LED OFF
Turn #121
LED ON
LED OFF
Turn #122
LED ON

wrote a small lua script:

#!/usr/bin/lua

print("Content-Type: text/html")
print("")
print("<!DOCTYPE html>")
print("the Roland..<br>")


rserial=io.open("/dev/ttyATH0","r")

while true do
  for line in io.lines("/dev/ttyATH0") do
    print(rserial:read())
    io.flush()
  end
end

Calling it from the shell:

root@domino:/www/cgi-bin# /usr/bin/lua seriall.lua
Content-Type: text/html

<!DOCTYPE html>
the Roland..<br>
Turn #292
LED ON
LED OFF
Turn #294
LED ON
LED OFF
Turn #296
LED ON
LED OFF
Turn #298
LED ON
^X

and calling it via http://192.168.43.86/cgi-bin/seriall.lua :

the Roland..
Turn #345 LED ON LED OFF Turn #347 LED ON LED OFF Turn #349 LED ON LED OFF Turn #351 LED ON LED OFF Turn #353 LED ON LED OFF Turn #355 LED ON LED OFF Turn #357 LED ON LED OFF Turn #359 LED ON LED OFF Turn #361 LED ON LED OFF Turn #363 LED ON LED OFF Turn #365 LED ON LED OFF Turn #367 LED ON LED OFF Turn #369 LED ON LED OFF Turn #371 LED ON LED OFF Turn #373 LED ON LED OFF Turn #375 LED ON LED OFF Turn #377 LED ON LED OFF Turn #379 LED ON LED OFF Turn #381 LED ON LED OFF Turn #383 LED ON LED OFF Turn #385 LED ON LED OFF Turn #387 LED ON LED OFF Turn #389 LED ON LED OFF Turn #391 LED ON LED OFF Turn #393 LED ON LED OFF Turn #395 LED ON LED OFF Turn #397 LED ON LED OFF Turn #399 LED ON LED OFF Turn #401 LED ON LED OFF Turn #403 LED ON LED OFF Turn #405 LED ON LED OFF Turn #407 LED ON

hooray :slight_smile:

Someone send me $10 :slight_smile:

I just tried according to your post:

  1. disable the "askfirst" line in /etc/inittab
  2. reboot
  3. ssh to domino, install screen
  4. screen /dev/ttyATH0 115200
Everything works fine. No "/var/run/utmp" error

Just found that your programming was actually working. So, ignore my reply.

Great you still keep a watch on this forum :slight_smile:
(You should finally reboot domino.io and send an update to all your backers inviting them to a little contest for the 10 best user applications so far…)

Next step would be do connect a Core directly to the Arduino. But now i see that it will not be enough to connect RX/TX/VC/GND but it needs up to 10 GPIO pins to be pulled up or down in order for the Core to boot :frowning:

How much will it help to put the Core onto the Di-Board ? Will that already handle the complete bootstrap ?

And i guess, the LED-pins will be set to “output” later, so simply pulling them up or down will kill then kill the Core ?

My idea here was to simply use the Core as the wifi-brain and let the Arduino do any io as i need analog input anyway. Might even like to attach these cheap spi displays to the adruino and operate them via serial commands…

So what is the most simple way to let the brain startup ?

ideas welcome.

double post

today i connected the Arduino Mini to those cheap mini routers which the Core is more or less based on.

wiki.openwrt.org/toh/nexx/wt3020

Connecting the three cabels to the serial port was easy: howto_flash_openwrt_on_wt3020.html

As i did not have a lan cable i had to connect via serial from my laptop via putty and enable wifi:
uci set wireless.@wifi-device[0].disabled=0; uci commit wireless; wifi
wiki.openwrt.org/doc/uci/wireless

Then again comment out the last line in /etc/inittab
and i had to change the baud rate to “Serial.begin(57600);” in the Arduino code.

wrote the lua script via console:

root@OpenWrt:/www/cgi-bin# vim robo.lua
#!/usr/bin/lua

print ("Content-Type:text/html")
print("")
print("hello lua :-)")

s = "/dev/ttyS0"
i = 0
while i < 10 do
        print(s .. ": " .. i)
        for line in io.lines(s) do
                print("read : " ..line)
                io.flush()
        end
        i=i+1
end

print("bye :-)")

As i am still unsure about how to correctly bootstrap the Core, i have continued with the NEXX.
Did add three more cables: 3.3V , 5V , GPIO2 - which i connected to DTR of the Arduino :slight_smile:
That why i should even be able to upload a new arduino-image from the Nexx/Core (compiling might be done on my laptop or vserver).
Was able to trigger lots of resets with

#!/bin/sh cd /sys/class/gpio for i in seq $1 $2; do echo $i > export; echo out >gpio$i/direction done nums=seq $1 $2 while true; do for i in $nums; do echo 0 > gpio$i/value done sleep 1 for i in $nums; do echo 1 > gpio$i/value done sleep 1 done
from finding_gpio_pins_on_the_pcb, running it with "root@OpenWrt:~# ./gpo.sh 2 2"

At best case, i could simply trigger a reset and then send the new arduino image via serial write. Have to check this out at arduino.cc

Ideas welcome !

There are several GPIO should not be touched when booting, GPIO16, GPIO13, GPIO11. Using them after boot should be fine.

Thanks Alzhao and yes i know this is a beginners question :-/ But the specs-pdf states:

GPIO	Bootstrap Function Pulled Down Pulled Up
GPIO0 low	Crystal frequency 25 MHz 40 MHz
GPIO1 high	Boot from ROM SPI Flash
GPIO11 low	ICE interface JTAG CPU ICE
GPIO12 low	Memory type LSB SDRAM/DDR2 DDR1
GPIO13 high	USB Mode Device Host
GPIO14 low	Chip Mode LSB 0 1
GPIO15 low	Chip Mode MSB 0 1
GPIO16 low	Firmware download from USB from MDIO
GPIO17 high	Ethernet off on
GPIO28 high	Memory type MSB SDRAM/DDR1 DDR2

So what do you mean with “not be touched” ?
Do i need resistors to pull up or down ?
The pdf states “LED0…6 are also used for bootstrap settings. To avoid applying a wrong voltage on the I/O pin coming from the LED, these GPIOs should be sourcing current only, not sinking current.”

What is the absolute minimum to let the Core startup correctly ?
A nice image like the attached one (ESP8266) would make it crystal clear for beginners like me.

http://domino.io/#!domino/hardware/core.md

If you use Domino Di bareboard, pls check the link above. Several components needs to be attached.