1 / 37

Modernize Your Home or Garage with Java ME Embedded: Tutorial

Modernize Your Home or Garage with Java ME Embedded: Tutorial. Alexander Mironenko , Denis Magda Java ME Embedded Team.

morgan
Download Presentation

Modernize Your Home or Garage with Java ME Embedded: Tutorial

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Modernize Your Home or Garage with Java ME Embedded: Tutorial Alexander Mironenko, Denis MagdaJava ME Embedded Team

  2. The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle.

  3. Program Agenda • Java ME Embedded 3.4 • Light System • Temperature System • Alarm System • Remote Control • Write Once Run Anywhere

  4. Java ME Embedded 3.4

  5. Java ME Embedded 3.4 What’s New? • New supported platform! • Qualcomm Internet of Everything (IoE) Development Platform • Full-featured tooling over Serial/USB • Debugging/profiling directly from NetBeans and Eclipse • Logging • Command Line Interface • Available only for Qualcomm IoE Development Platform • Java API is the same as in Java ME Embedded 3.3

  6. Qualcomm IoT Development Platform Modular & flexible Complete development and prototyping platform CPU, RAM/Flash, I/O, GPS, 3G, WiFi Extensible through pluggable modules Universal IoT/M2M platform Quickly and easily start building advanced IoT concepts with Java Leverage Qualcomm“Internet of Everything” developer programm Running Oracle Java ME Embedded 3.4

  7. Java ME SDK 3.4 What’s new? • Complete emulation of Qualcomm IoE Development Platform • Sensors: g-sensor, temperature sensor, accelerometer • Peripherals: ADC, DAC, GPIO pins and ports, pulse counter • Emulated device name is Qualcomm_IoE_Device • Tooling over Serial/USB support on the SDK side • Can be leveraged from both NetBeans and Eclipse • Just connect to an appropriate COM port with SDK’s Device Manager!

  8. Oracle Java ME Embedded 3.4 Stack A rich embedded application platform

  9. JSRs supported on IoE Platform Rich, standardized functionality for embedded solutions

  10. Oracle APIs supported on IoE Platform

  11. Device Access API Access Peripheral I/O Hardware directly from Java applications • Generic API to access peripheral I/O in a platform-neutral manner • ‘Late binding’ allows addition of new peripheral types without changing API • Enables development of Java-based ‘device drivers’ (non-real time) • No native application code • Also planned for availability on Java SE Example 2 Simple GPIO Pin- basedsensor reader (low level application) Example 1 Real-Time Clock Peripheral Implementation (High Level Driver) Application Layer Device Access API On-Device I/O Peripheral Access Application Environment Java VM CLDC

  12. Device Access API on IoE Platform

  13. Light System

  14. Light System Components Relay Connect and … Control? LEDs

  15. Light System GPIO(General-Purpose Input/Output) Introduction • GPIO is a logical pin that is used for read/write operations • Individual pins have a voltage value of either high or low • GPIO pins are commonly used to read buttons (switches) and to drive TTL-level devices such as light-emitting diodes.

  16. Light System Physical connection

  17. Light System Turning on and off the light // Configuration for a GPIO that controls the light • GPIOPingConfiggpioConfig = newGPIOPinConfig(PeripheralConfig.DEFAULT, 11, • GPIOPinConfig.DIR_OUTPUT_ONLY, • GPIOPinConfig.DEFAULT, GPIOPinConfig.TRIGGER_NONE, false) • // Open GPIO GPIOPin pin = (GPIOPin) PeripheralManager.open(gpioConfig); // Turning on the light pin.setValue(true); Thread.sleep(5000); // Turning off the light pin.setValue(false); Thread.sleep(5000); pin.close();

  18. Temperature System

  19. Temperature System Components • Temperature sensor connected to a SPI bus is used for measurements • Advantages: • Simple connection • Easy to configure • Fast measurement

  20. Temperature System SPI Bus Introduction • SPI (Serial Peripheral Interface) – synchronous serial data interface used for communication between multiple peripheral devices and single main device • Key features: • MOSI(master output slave input), MISO(master input slave output) lines for data transmission • Clock of bus is controlled by master • Dedicated physical lines for slave addressing

  21. Temperature System Retrieving Temperature // SPI configuration for the temperature sensor SPIDeviceConfigspiConfig = newSPIDeviceConfig(1, 256, 2000000, 1, 8, Peripheral.BIG_ENDIAN) // Get access to the sensor SPIDevicetempSensor = (SPIDevice) PeripheralManager.open(spiConfig); // Retrieve current temperature tempSensor.begin(); tempSensor.write(0x02); tempValue = tempSensor.read(); tempSensor.end()

  22. Alarm System

  23. Alarm System Components • Optical photo interrupter is used as a an alarm sensor • Connected to a GPIO pin • Read values in a loop… Activate triggering and wait for events!

  24. Alarm System Leveraging GPIO Callbacks // Configuration for a GPIO: direction – input, trigger type - rising edge • GPIOPinConfigpinConfig = newGPIOPinConfig(PeripheralConfig.DEFAULT, 15, • GPIOPinConfig.DIR_INPUT_ONLY, GPIOPinConfig.DEFAULT, • GPIOPinConfig.TRIGGER_RISING_EDGE, false) // Open GPIO pin GPIOPin pin = (GPIOPin) PeripheralManager.open(pinConfig); // Listen for notifications pin.setInputListener(new PinListener() { public void valueChanged(PinEventpe) { // Receive and process an event } });

  25. Remote Control

  26. Remote Control Components • Flexible external GSM/GPRS modem will be used as network wireless device • Key features: • Can be easily connected to the board through UART • AT commands are used to manage the modem • No registers, no direct memory, just send, receive and parse strings!

  27. Remote Control UART introduction • UART (Universal Asynchronous Receiver/Transmitter) is a module used for serial communications • Key features: • No addresses like in buses, just connect and send data • Supported by wide range of devices • Fully asynchronous reading and writing • Use only two physical lines

  28. Remote Control UART usage example // UART configuration to use • UARTConfigconfig = newUARTConfig(PeripheralConfig.DEFAULT, 115200, UARTConfig.DATABITS_8, UARTConfig.PARITY_NONE, UARTConfig.STOPBITS_1, UARTConfig.FLOWCONTROL_NONE); • // Open UART • UART uart = (UART) PeripheralManager.open(config); • // Open input and output streams • InputStream is = uart.getInputStream(); • OutputStreamos = uart.getOutputStream(); • // Perform read/write • is.read(inBuffer); • os.write(outBuffer);

  29. Write Once Run Anywhere

  30. Target Platform Raspberry Pi • Rasbperry Pi (model B) • Broadcom BCM2835 (ARM1176JZF) SOC • 700 MHz, 512 MB RAM, Linux (Debian) • ~1 million devices sold, US $35 • Java ME Embedded 3.3 • Device Access v B • Java ME Embedded 8 EA available • Device Access v C

  31. Let’s Run the App on the Pi during 5 mins Single application on different boards

  32. Java ME 8 EA

  33. Target Platform STM32F4Discovery Board • STM32F407VGT6 microcontroller • 168 MHz Cortex-M4 • 192 KB RAM • 1 MB Flash • ~ US 20$ per board • Java ME Embedded 8 EA • CLDC 8.0 • MEEP 8.0 – Minimal Profile Set • Device Access API v C: GPIO, I2C, SPI, UART

  34. Useful Links • Oracle Java ME Embedded • http://www.oracle.com/technetwork/java/embedded/overview/javame/index.html • Java ME SDK • http://www.oracle.com/technetwork/java/javame/javamobile/overview/getstarted/index.html • Qualcomm IoE Development Platform • https://developer.qualcomm.com/mobile-development/development-devices-boards/development-boards/internet-of-everything-development-platform

  35. Q/A

More Related