Programming for IOT developer

Discussion in 'Programmer's Corner' started by Parth786, Dec 23, 2017.

  1. Parth786

    Thread Starter Active Member

    Jun 19, 2017
    I have started working on internet of things project. I have looked programming skill's for IOT developer in internet and I have seen so many language such as php, java script, python..etc. I do not have much experience of all three but I can learn. I want to learn the language that is most commonly used to develop IOT project.

    Let me take two project
    1. Home monitoring system based on IOT
    2. Park monitoring system based on IOT
    These were just example I just want to know one thing if I want to write program for iot program what the programming skill i need to require for any project

    I understand the hardware part of the project. I know what hardware need to develop project but I am having problem in programming part But I couldn't decide how to write a program for any project.
    Note: Please don't tell me so many option. Just tell me what programming language do you use to make IOT project.
  2. Papabravo


    Feb 24, 2006
    It just doesn't matter. Nobody from the outside can tell what language you used and the device itself does not care. Use whatever is available and convenient.
    1. First make it work
    2. Then make it fast
    3. Then make it elegant
    That's all you need to know.
    xox likes this.
  3. Parth786

    Thread Starter Active Member

    Jun 19, 2017
    Main problem is that there are so many way and I want to follow only one way which is more popular in now a days.

    I have seen php, python and java These are mostly used in the project

    Let take two project
    1. Home monitoring system based on IOT
    2. Park monitoring system based on IOT
    Now How to start programming for these project's. What would you do if you were in my place
  4. Papabravo


    Feb 24, 2006
    Why would you want to do that? Popularity is hardly a reason for (mis)using something. You pick something popular and by the time the project is finished the popular thing is an also ran. You can keep setting up straw men, but you would be better served by doing your first implementation and throwing it away. Why? Bbecause ultimately you will end up doing that anyway. Instead of engaging in slow stupid failure, put an implementation together in the shortest possible time and learn from your mistakes. With this approach it just doesn't matter what mistakes you make.
    Last edited: Dec 23, 2017
  5. Parth786

    Thread Starter Active Member

    Jun 19, 2017
    May be you didn't understand what I was asking or I didn't understand your answer. I have not found yet what I was looking for.

    Most of companies work on recent technology. I think I should learn programming language which has more demand then other. so that I can get more chance to get job.

    Suppose I want to make street light monitoring system based on internet things I think I can do programming for this project in two way

    First way , HTML for web page and PHP for server as backend
    Second way, HTML for web page and Python as backend

    Am I right ? I want to know on which technology most of companies works. I don't want to work on outdated technology
    Last edited: Dec 23, 2017
  6. Papabravo


    Feb 24, 2006
    I'm not sure any of those options are appropriate, but I could be wrong. In fact why don't you prove that I'm wrong.
  7. spinnaker

    AAC Fanatic!

    Oct 29, 2009

    Then why not learn multiple languages? Once you get one down, learning the next is that much easier. Just like learning spoken languages that aren't your first language.

    Learn to program in a language that is easy for you first. Then start worrying about the next one.
  8. Parth786

    Thread Starter Active Member

    Jun 19, 2017
    I know you have knowledge about internet of things, so that's why you replied on this thread. I think I should explain question in some other way.

    Suppose you are IOT developer and I have given you three project
    1. Home monitoring system based on IOT
    2. Park monitoring system based on IOT
    3. Street light monitoring system based on IOT
    I have already explained my approach for programming. How will you do programming for these project's as IOT developer ?

    I have taken those example just for learning. I just want to see how do you complete part of programming. I am just talking about programming language

    Note : Use only raspberry Pi. don't use esp8266
    Last edited: Dec 23, 2017
  9. Papabravo


    Feb 24, 2006
    First tell me what the requirements are for the various devices. Then tell me what hardware platforms are available and economically viable. Then tell me what hardware I have available to host the development tools. Then tell me what tools are available for less than or equal to some budget amount eg. $50. Now we can begin the top level design of the server devices, including what information they will exchange with the client side. At the same time we can design the client side applications to run on their platform including what information they will exchange with their server devices.
    Taking what you have told me about the availability of device platforms, development systems, and software tools I flip a coin or use "dragon dice" to select one of the alternatives and go with it.

    The point here is that the actual choice is irrelevant for at least two reasons:
    1. As you proceed with the implementation you will quickly develop a sense for the probability of success. Rapid failure increases the chance of ultimate success.
    2. None of the design you have done has to be discarded if you change to another means of implementation.
    Don't waste another minute obsessing about the choices -- just do something!
    xox and spinnaker like this.
  10. be80be

    AAC Fanatic!

    Jul 5, 2008
    java is probably #1 but i don't think you even opened the files i gave you.
    just because the pi didn't use it at first don't mean the rest was better there was no easy way to comply on a pi

    But java is in everything it's almost totally cross platform phones use cars use tv dishwashers hell about everything can.
    that has arm uC in it.

    People don't look at the bit's they looks at a app that they use.

    Like this
    Code (Text):
    1. import*;
    2. import*;
    3. import java.util.*;
    5. /**
    6. * This class represents a Button connected to the Raspberry pi on a given pin.
    7. * Connect the button to 3.3v power and to a GPIO.
    8. *
    9. * @author Fabio Hedayioglu
    10. * @author Ian Utting
    11. * @author Michael Kölling
    12. * @version 1.0
    13. *
    14. */
    15. public class Button
    16. {
    17.     // the button instance is an input pin.
    18.     private GpioPinDigitalInput button;
    20.     //this array maps the GPIO pin numbers to integers
    21.     private static final Pin[] pinMap = new Pin[] {RaspiPin.GPIO_00, RaspiPin.GPIO_01, RaspiPin.GPIO_02, RaspiPin.GPIO_03, RaspiPin.GPIO_04,
    22.         RaspiPin.GPIO_05, RaspiPin.GPIO_06, RaspiPin.GPIO_07, RaspiPin.GPIO_08, RaspiPin.GPIO_09, RaspiPin.GPIO_10,
    23.         RaspiPin.GPIO_11, RaspiPin.GPIO_12, RaspiPin.GPIO_13, RaspiPin.GPIO_14, RaspiPin.GPIO_15, RaspiPin.GPIO_16,
    24.         RaspiPin.GPIO_17, RaspiPin.GPIO_18, RaspiPin.GPIO_19, RaspiPin.GPIO_20};
    26.     //the default pin, used by the constructor without parameters.
    27.     private final static int defaultPin = 7;
    31.     /**
    32.      * Creates a Button at the default GPIO pin (7).
    33.      *
    34.      */
    35.     public Button()
    36.     {
    37.         //create the Button in the default pin.
    38.         this(defaultPin);
    39.     }
    42.     public Button(int p)
    43.     {
    44.         //get a gpio controller
    45.         GpioController gpio = GpioFactory.getInstance();
    46.         Collection<GpioPin> existingPins = gpio.getProvisionedPins();
    48.         //if this button wasn't previously privioned, do it.
    49.         button = getProvidedPin(pinMap[p]);
    50.         if (button == null){
    51.             button = gpio.provisionDigitalInputPin(pinMap[p], PinPullResistance.PULL_DOWN);
    52.         }
    54.     }
    56.     private GpioPinDigitalInput getProvidedPin(Pin desiredPin)
    57.     {
    58.         GpioController gpio = GpioFactory.getInstance();
    59.         Collection<GpioPin> existingPins = gpio.getProvisionedPins();
    60.         for (GpioPin pin:existingPins){
    61.             if (pin.getPin() == desiredPin){
    62.                 //this pin is already provisioned. take it.
    63.                 return (GpioPinDigitalInput) pin;
    64.             }
    65.         }
    66.         return null; //not found
    67.     }
    69.     /**
    70.      * Checks in the button is pressed.
    71.      *
    72.      */
    73.     public boolean isPressed()
    74.     {
    75.         return button.isHigh();
    76.     }
    78.     /**
    79.      * Add a listener to this button.
    80.      *
    81.      */
    82.     public void addListener(final ButtonListener listener)
    83.     {
    84.         //creates a GpioPinListener to listen to this pin..
    85.         GpioPinListenerDigital l = new GpioPinListenerDigital() {
    86.             @Override
    87.             public void handleGpioPinDigitalStateChangeEvent(GpioPinDigitalStateChangeEvent event)
    88.             {
    89.                 //checks if the raised event is for this pin.
    90.                 if (event.getPin().getName().equals(button.getPin().getName())){
    91.                     //if it is, then call the event buttonChange in  our ButtonListener class and pass the
    92.                     //current state of the button (pressed = true, released = false)
    93.                     listener.buttonChanged(event.getState().isHigh());
    94.                 }
    95.             }
    96.         };
    97.         //add the listener to this button.
    98.         button.addListener(l);
    99.     }
    101.     /**
    102.      * Remove all listeners from this button.
    103.      *
    104.      */
    105.     public void removeAllListeners()
    106.     {
    107.         button.removeAllListeners();
    108.     }
    110. }
    Last edited: Dec 23, 2017
    Parth786 likes this.
  11. Parth786

    Thread Starter Active Member

    Jun 19, 2017
    I have started working on project using HTML and PHP. I can switch ON/OFF LED using PHP script on Pi

    I worked on it. I can switch ON/OFF LED. I told you that I am getting confuse in selection of programming language. You said, I should learn embedded java.

    I did some research on internet, I found out most of Pi users use java script and node.js for their project.
    Last edited: Dec 23, 2017
  12. be80be

    AAC Fanatic!

    Jul 5, 2008
    Do you want make a living or play with leds on the pi
    Your lost there javascript is going to be lots of it on the web.

    But that's because you could not comply java on a pi now you can and as these kids start using the new java tools
    you'll start seeing app's that deploy the pi to do things lights camera action.

    javascript is scripting language for Web pages

    EmbeddedJava is Sun Microsystems' software development platform for dedicated-purpose devices with embedded systems, such as products designed for the
    automotive, telecommunication, and industrial device markets

    There not the same EmbeddedJava is what you want learn if you want a job that makes something as a programmer

    javascript if you want play with the web and the pi

    Now I'm not saying web developers don't make money

    But I think you said you want be a programer learn EmbeddedJava
    time you do that
    You not even have to think to write some javascript
    Last edited: Dec 23, 2017
  13. MrSoftware

    Senior Member

    Oct 29, 2013
    "Products" have different components, built using different technologies. Small physical sensor devices are probably programmed using C or assembly. Communication between components your PCB may use SPI, I2C, I2S, etc.. If there's a web interface to it then you may choose to use a plug-in web server that allows you to program the interface using PHP and/or javascript. If there's a database component then you'll likely use something like SQL. Are you worried about hackers or your device being used as a zombie in a DDOS attack? Then be sure you understand the security aspect. If it talks to the cloud then you'll need to program that component, as well as an API for connecting the device to your cloud server securely using something like OAuth, which also means you need to understand https.

    So in short; first define (full specification) exactly what you're trying to make, THEN determine which technologies you need to learn to make that happen. In my personal opinion anyway..
    Last edited: Jan 2, 2018