empowering creative people

How to Setup ATOM (Code / Text Editor) on Onion Omega2

In this tutorial, we will learn how to code for the Onion Omega2 on our PC, and then wirelessly upload our code using the ATOM text editor.

The ATOM text editor is a powerful and easy to use text editor developed by the team at Github. It is also the preferred editor of both the Onion Dev Team and our team here at Core. This is for good reason:

  • It's free and open source.
  • It's powerful yet simple to use.
  • It integrates easily with almost any programming language or device.
  • Free expansion packages make it easily tailored to any application.
  • Can remotely edit files with SFTP.
  • Can perform real-time syntax checking.
  • Can perform real-time predictive coding.

Before we install ATOM, we need to set up our Omega2 with an SFTP server. To do this, make sure your Onion Omega can access the internet and that your computer can access the Onion Omega2. If you need to perform a first-time setup of your Omega check out our Getting started with your Onion Omega2/2+ guide.

Open the Omega GUI Console then open the editor app.

Navigate to the following file:


distfeeds.conf edit

We need to remove the two #marks from the line that reads:

## src/gz reboot_packages http://downloads.lede-project.org/snapshots/packages/mipsel_24kc/packages

So that it now reads:

src/gz reboot_packages http://downloads.lede-project.org/snapshots/packages/mipsel_24kc/packages

Now save the file, open the terminal app and enter the following two commands:

opkg update
opkg install openssh-sftp-server

openssh-ftp-server install

When both commands have finished running you can close the editor app in the Console-GUI.

Now we need to install the ATOM editor, visit http://atom.io to download the latest version of ATOM for your operating system.

Run the installer, ATOM should open automatically when the install is finished.


In the "Welcome Guide" pane on the right-hand side of the window, click on "Install a Package." Then click on "Open Installer."

This will bring up the packages search tool. This tool searches through all of the packages available for ATOM and can be used to equip ATOM with numerous features to improve the coding experience. Features such as syntax checking and FTP integration are just the beginning. Now click on the search field and search for "remote-ftp." The first result should be "Remote-FTP," click install to add it to ATOM. Close the packages install pane.

remote-ftp search

To test ATOM, we're going to edit a sample python program. First, click on "File > Add Project Folder" and point to a new folder for the sample python program. Now click on "Packages > Remote-FTP > Toggle" to bring up the Remote-FTP pane. Click "Edit Configuration." This will open an empty file called ".ftpconfig," add the following to it:

"protocol": "sftp",
"host": "Omega-xxxx.local",
"port": 22,
"user": "root",
"pass": "onioneer",
"remote": "/"

Replace "xxxx" with your Omega's four character name and update the password if you've changed it.

Save and close the ".ftpconfig" file and click "Connect" in the Remote-FTP pane. If all has gone well you should now see the Omega's file system in the right-hand pane. If you can't try the following:

  • Make sure the Omega and your computer are on the same network.
  • Make sure you have the omega's name and password correct.
  • Try using your Omega's IP address in the ".ftpconfig" file instead of its omega-xxxx.local address.

Once you have connected to the omega, create a folder to store our sample python program. Then open a new file and copy the following code into it:

import time
import onionGpio

gpioNum = 1
gpioObj = onionGpio.OnionGpio(gpioNum)

# set to output
status = gpioObj.setOutputDirection(0)

# alternate the value
loop = 1
value = 0
while loop == 1:
# reverse the value
if value == 0:
value = 1
value = 0

# set the new value
status = gpioObj.setValue(value)
print 'GPIO%d set to: %d'%(gpioNum, value)


Save the file as ATOM_test.py and open the Console-GUI and open the terminal app.

ATOM python demo file

The python script we just wrote will turn GPIO1 on and off forever. Attach two LEDs(with resistors) to GPIO1 and GPIO0.(We'll make use of GPIO0 in a minute.) If you don't have any LEDs, the script will also print the state of the pins to the terminal. 

Navigate to /root/python/ with the following command:

cd python

Then run the program with:

python ATOM_test.py

You should see some text being written to the shell and GPIO1 should be flashing!

Press CTRL-Z to end the program, and then return to ATOM.

Now we'll make a few changes, change "gpioNum = 1" to "gpioNum = 0" on line 4, and change "time.sleep(1)" to "time.sleep(2)" on line 24.

Save the file and return to the terminal. Run the program again and notice the changes. GPIO0 should now be flashing, and slower than before.

Thanks for reading, we hope this helps you out, if you have any comments, questions or you need some advice please comment below or head over to our forum. We've got a full-time team of makers and we're here to help! PS stay tuned for our "Getting Started with Python" guide for the Onion Omega2 soon.

In this tutorial, we will learn how to code for the Onion Omega2 on our PC, and then wirelessly upload our code using the ATO...