@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:
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.
_____ _
| __ \ (_)
| | | | ___ _ __ ___ _ _ __ ___
| | | | / _ \ | '_
/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
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
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 ?
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
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.
Then i connected tx/rx/gnd to that lan-tile of the Domino…
Was able to install “screen” on the Core
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
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
Great you still keep a watch on this forum
(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
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 ?
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
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
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.