Page 1 of 1

Using Raspberry Pi like an Arduino?

Posted: Sat Dec 12, 2015 3:51 pm
by aquadog90
I would like to build a circuit board tester using Raspberry Pi. The device will be used by other staff members hence I will implement a GUI possibly with a touchscreen.

I have a lot of previous experience with Arduino however it wont handle GUI and all the GPIO at the same time very well. Also I was looking forward to do my first Raspberry Pi project for a long time.

For the requirements:
I would like to Pi too boot straight into the code/program like Arduino do nothing else. Is this possible?

Is it possible to program the Raspberry Pi on a different machine and just run the code again like arduino? I think it would be easier to program using my main machine and just see the results on the pi.

I did a research on the internet but a lot of scattered information and nothing is clear especially that this will be my first project and I'm not sure how all the boot loaders and stuff work. I am hoping for some kind of genius here to provide a little bit of support or a link?


Re: Using Raspberry Pi like an Arduino?

Posted: Sat Dec 12, 2015 5:34 pm
by joan
The Pi takes 15+ seconds to boot, after which it will auto run any programs you want.

You can develop on other machines and then deploy to the Pi. That's what cross-compilers are for. How easy that is depends on what sort of program you are developing.

The tools will not hold your hands as much as the Arduino IDE.

Re: Using Raspberry Pi like an Arduino?

Posted: Sat Dec 12, 2015 5:59 pm
by TimG
It's possible to run the RPi without an operating system, as the Arduino does. But it's not at all straightforward, and programming a GUI would be a lot of work. See viewforum.php?f=72

An easier solution is to run the RPi as normal, but have it automatically login and start a full-screen application. It means waiting a few seconds for the system to boot, but allows you to choose from a wide range of languages and GUI libraries.

A nice way of getting a GUI without writing a lot of code is to serve your application as a web page. Even an Arduino can run a simple web server, and it means you don't have to build the interface hardware.

Re: Using Raspberry Pi like an Arduino?

Posted: Sat Dec 12, 2015 8:14 pm
by Heater
You can create your GUI in C++ using the Qt GUI tool kit.

Do the bulk of that work on your PC (Windows, Mac or Linux).

When that is designed, coded, tested move the source code to the Pi and compile it there.

Qt GUI programs can be run full screen without X Windows. The GUI coming up fast when you power up the Pi.

However, I agree with TimG. Create your user interface as a web page.

Use node.js and write the web server part in Javascript. With node and JS you have easy access to the GPIO, serial ports, file system etc, whilst serving up the web page GUI.

I have been experimenting with this approach here: source code here:.

Re: Using Raspberry Pi like an Arduino?

Posted: Sat Dec 12, 2015 8:17 pm
by aquadog90
Ok will research a cross compiler and see how does that work. Any recommendations for first time user?

Never thought about that idea of running a program in a web browser will research that as well. I assume it will be able to access all the GPIO ports

Re: Using Raspberry Pi like an Arduino?

Posted: Sat Dec 12, 2015 8:24 pm
by Heater
I seriously advise against getting involved with cross compilers.

Yes, it can be done, and easily if a ready made cross compilation package is available.

It is also unnecessary and likely a cause of much frustration.

With a cross platform environments like Qt one can compile the same code on Windows, Mac or the Pi. Using the native compilers on each. Only the source code moves around from machine to machine.

With interpreted languages like Python, Javascript etc there is no compilation step to worry about.

One does not run all the code in the web browser. The browser cannot access GPIO, serial ports, your file system, etc. All for web security reasons.

What you do is write a simple web server that can serve up the web page to the browser and tweak with the GPIO and other hardware. When the web page is served up to the browser it will have Javascript code in it to run the GUI. The Javascript in the browser and the code in server communicate between each other.

Re: Using Raspberry Pi like an Arduino?

Posted: Sat Dec 12, 2015 8:55 pm
by pxgator
This is the easiest way to create GUI programs that I have ever used. ... rocessing/
It is processing 3.0.1 based on Java. I'm running it using a RPI 2 and so far
everything has worked great. If you decide to give it a try you will need
to install the G4P library and G4P GUI builder from within the processing IDE.
I can't imagine how GUI programming could be any easier. It comes with
a hardware library that works very well with the RPI's gpio.

Re: Using Raspberry Pi like an Arduino?

Posted: Sun Dec 13, 2015 1:57 pm
by Pithagoros do an arduino board that builds directly onto the GPIO pins of a PI and almost becomes part of it. Might give the best of both worlds.

Re: Using Raspberry Pi like an Arduino?

Posted: Sun Dec 13, 2015 4:01 pm
by DougieLawson
The Gertduino and Arduberry also give you an Arduino that sits on the GPIO pins. Both of those are better than the version because stock standard Ardunio shields can fit straight on the add on boards.

Re: Using Raspberry Pi like an Arduino?

Posted: Sun Feb 21, 2016 4:51 pm
by aquadog90
I'd like to refresh this post with fresh question.

So got my raspberry Pi official touch screen 7" and have decided to use Java to build my GUI and etc

I currently in a process of setting up the raspberry pi remote connection with Netbeans, however cant go past certain error.
So my raspberry pi has the latest java 8 jdk installed and updated. So as my PC latest java SE and Netbeans 8.1.

The problem occurs when I try to setup the remote java platform. I type my Pi IP, login, password etc.. As "remote JRE patch" I have {/usr/lib/jvm/jdk-8-oracle-arm-vfp-hflt} and as "working dir standard Netbeans folder.

I will press finish and in Netbeans I can see the connection is made and the Netbeans project folder has been remotely created on my Ras Pi however Netbeans cant seem to find the remote java software on Ras PI..

The patch shone above is correct it also exists on the Pi (I have checked) but Netbeans reports with an error saying patch doesnt exist..

Below is a output dialog
Connecting to
cmd : mkdir -p '/home/pi/NetBeansProjects/'
Connecting to
Connecting to
cmd : cd '/home/pi/NetBeansProjects/'; '/usr/lib/jvm/jdk-8-oracle-arm-vfp-hflt/bin/java' -jar org-netbeans-modules-java-j2seembedded-probe.jar
bash: /usr/lib/jvm/jdk-8-oracle-arm-vfp-hflt/bin/java: No such file or directory
C:\Users\HTPC\AppData\Local\Temp\antScript4618495577359612413.xml:65: Remote command failed with exit status 127
BUILD FAILED (total time: 11 seconds)