Chances are we already did this for you, unless you are really lucky (first generation boards). Then again, should you choose to rebuild everything to it’s defaults oem stage, this is the same procedure. This is what you would do after debricking your board as well (after a few other steps).
- From a separate window or tab on your terminal, download and copy the kernel file to the controller using the following syntax
- This should download a the kernel file called v2kernel.tgz
- Remember the location of the download
- Power your v2 board using the 9-48vdc supply on the dc socket and depress the power switch
- On your computer, scan for WIFI networks and look for an Openwrt_XXXXXX access point
- Connect to this ( in my case this time it is Openwrt_FFFFFF)
- DHCP should assisgn you an ipaddress in the 192.168.1.x network
- run the following command from
- use the following command to change the root passwd
- In a separate terminal window access the folder where you downloaded the kernel
- from the download folder copy the file to the client using the flowing syntax
scp v2kernel.tgz firstname.lastname@example.org:/tmp
- from the telnet window connected to the client, change directory to /tmp using the following syntax
- extract and install the kernel using the following syntax:
tar -xzvf v2kernel.tgz sysupgrade -v -n openwrt-ar71xx-generic-oolite-squashfs-sysupgrade.bin
- The controller will reboot after the kernel upgrade – do not touch your controller until it reboots to avoid bricking it. Look at the system LEDs they should flash as the system boots.
- because we just did a system factory flash, we have to reset our password again, but this time we have to use the ethernet cable
- connect your ethernet cable from your computer to the controller as shown above
- the controller should assign you an ip address in the 192.168.1.1 network (this can get confusing if your wifi access point is already configured on the 192.168.1.x network). for now, in this case, disable you computer wifi as you following these instructions to avoid ip address conflicts between the controller and your computer.
- telnet to over ethernet to change the passwd, as previous shown before
- change passwd as befefore, using:
- exit out of telnet by typing ‘exit’ and ssh to the controller using
- because of the earlier scp session, linux may give ssh errors thinking it is man-in-the-middle attack. fix it using the instructions it presents to you as shown below, the ssh in again using the default password ‘tempV2pwd’ set above (use whatever password you set)
- in ubuntu, fix by copying and pasting the command on your terminal suggested as shown in the diagram above:
ssh-keygen -f "/home/emaundu/.ssh/known_hosts" -R 192.168.1.1
- then connect again using ssh as shown below:
- the reason for this dance is because by default no password is set for root, and ssh/scp will not work without a password. so we have to connect with telnet first to create a root password, then we can use the more secure ssh tools. our computer things we are being hacked as we are connecting to two machines(old and new) that are the same machine!
- extract the application package:
tar -xzvf kijanigrowsV2install.tgz
- run the setup file
- this should reboot the controller at the end of it’s execution to finish it’s configuration
- if all goes well, the controller should boot and it’s onboard 8 gpio LEDs should be flashing at a one second interval after it resumes.
- we are now ready for the 2560 arduino sketch
Openwrt is fun as it also include LuCi – a web user interface for embedded devices. So system configuration is easy and does not involve command line processes.
Configuring Host names and Time-zone
With the ethernet cable still connected open up a browser and point the url to
- Log in using your custom password you created in the previous steps or use the default password ‘tempV2pwd’ in the following screen
- Click on the System drop down menu then Select System from the options as shown below:
- Change the Hostname and Time on the system presented as shown below:
- Save and apply
- Click on Network then WIFI
- Look for your WIFI network on the list and clink on the ‘jon network’ button the far right side on the line with your WIFI access point
After your client connects to WIFI, see it’s new WIFI address from the status screen as shown below:
Installing arduino firmware
Normally, the arduino and linux communicate through the serial line UART0 with the programming switch on the 9331 side. UART0 is also used to program the atmega 2560 but in this case with the switched flicked onto the 2560 as shown below.
- Disconnect the ethernet cable and use the WIFI ip address to ssh to the controller from your computer
ssh email@example.com (The ip address found from OpenWRT/Luci)
- Download the following arduino sketch file v2_json_io.ino
- You will also need the following libraries in your arduino libraries directory: Arduino-Temperature-Control-Library-master, DHT-sensor-library-master, OneWire, and RTClib-master
- If you are using a mac please install ftdi chip drivers here
- the microusb port on the v2 controller to the usb on your computer.
- compile and upload the arduino compatible sketch file to te 2560 using the arduino ide or Makefile.
- flick the switch back to the 9331 side.
- turn power off using the power switch then back on after a few seconds.
- this time, the led’s but the 2560 should start scrolling as the others flash as before
Restart your smart controller by pushing the power botton ( will have a script for doing this more elegantly shortly)
If all goes well, your controller should started up with Leds flashing and scrolling. This time your data should be going to the remote server.
Website url for testing your build will come here shortly. currently using grafana at http://api.kijanigrows.com:8080/grafana