[SOLVED] ODLib: Digital IO,PWM,LCD,Servos,Motors,I2C,...

Moderators: odroid, mdrjr

[SOLVED] ODLib: Digital IO,PWM,LCD,Servos,Motors,I2C,...

Unread postby TrippleAAA » Mon Jun 13, 2016 5:21 am

.

Updated: 29.07.2016:

-----------------------------------
ODLib_v9_6.zip
(1.1 MiB) Downloaded 109 times

-----------------------------------

New: TouchHDMI 800x480 XPT2046 SPI support + Example
New: Rotary Encoder support + Example
Fixed: Pin Interrupt function "setInterrupt"
New: LCD Nokia 5110/3310 PCD8544 (SPI) + Example
New: Switchable PullUp Resistor with "pullUpMode(pin,mode)" + Examples
New: 3 times faster pin input/output speed
New: Added new Classes + Examples for I2C Sensors: Barometer BMP180, Humidity HTU21D, Luxmeter TSL2561, UVmeter SI1145
New: Support for PiUSV+ HAT (http://www.piups.net) with Example
New: System wide Native USB Keyboard and Mouse Listener (with Device "Grab" option)
New: Support for KeyPad Matrix (with or without Digital I/O HAT | MCP 23017 chip)
New: Options to change: Boot-Logo, Boot-Anaimation, Reboot
Fixed: Some issues
Removed: SoftServoPWM
New: OLED SPI + ColorOLED SPI Support
New: OLED Display (I2C)
New: Digital IO HAT (with MCP23017 Chip)
New: I2C Scanner
New: Switched off the Blue LED



How to use the ODLib:
===============

You need Eclipse (https://eclipse.org), + Android SDK: https://stuff.mit.edu/afs/sipb/project/ ... g-adt.html
... and Android_NDK_r11c (one of these, choose one, or the latest NDK here: https://developer.android.com/ndk/downloads/index.html):
(win32) http://dl.google.com/android/repository ... ws-x86.zip
(win64) http://dl.google.com/android/repository ... x86_64.zip
(mac) http://dl.google.com/android/repository ... x86_64.zip
(linux) http://dl.google.com/android/repository ... x86_64.zip

.... copy the NDK folder into this location (Mac): /Applications/Android_NDK_r11c (inside this you will have: the "ndk-build" folder)

Open Eclipse and import the project with: File -> Import -> Existing Android code .... and select the Source Code folder (ODLib). Choose a Example in the "ExampleActivity.java" and press "Run..." Thats it.

Hint: If you're not using a mac or using another NDK version, you have to edit the NDK path in Eclipse: Project -> Properties -> Builders -> New Builder -> Main -> Location: /Applications/Android_NDK_r11c/ndk-build




About ODLib:
=========

First, I'm with Android since 2008... and I've done a lot with Android and Arduino. So I can say, ODROID C2 + Android is the best Android/Arduino Board since years. No other Manufacturer has made it good and stable with a good and easy workflow. There are a lot of solutions out there with tries to bring Arduino and Android together... but they all failed (more than complicated solutions). So thanks to ODroid C2! And this is the reason for my ODLib for Android.

With ODROID C2 Android 5.1 (1.6) all what I wanted is working well:

- Android :)
- A lot of Memory
- 17 Digital Pins
- 2 Analog Pins (with ext. ADS 1015 I2C Board 6 Analog Pins, https://www.adafruit.com/product/1083)
- 2 I2C Ports (for I2C Boards)
- 2 Hardware PWM Pins for Motors
- 4 USB Ports
- Ethernet
- Wifi USB Dongle Support
- Bluetooth USB Dongle Support
- USB Video Cam 720p is working very stable!
- USB Soundblaster




Accessing the GPIO Header Pins:

You can access the GPIO Header Pins with my Android ODLib Library. Then you have also access to the Adafruit Servo HAT Board to use 992 Servos, Motor HAT Board to use 128 Motors and 64 Stepper Motors, and the Adadfruit RGB LCD Display 16x2 HAT Board. In contrast to wiringpi the ODLib library has its focus on ODroid C2 only, and is working out of the box without the need to change anything. Also you have native support for a lot of Pi HATs & other hardware boards.



Supported stackable Pi HAT Boards (controlled by I2C):
==================================

Adafruit Servo HAT (992 Servos)
Adafruit Motor HAT (128 Motors, 64 Steppers)
Adafruit RGB LCD Display 16×2 HAT
Digital I/O HAT with MCP23017 Chip
PiUSV+ HAT (http://www.piups.net)
TouchHDMI 800x480 XPT2046 SPI Board



Supported other Boards:
================

ADS 1015 Analog2Digital (I2C) [ function: int analogReadExt(I2C-Port, I2C-Addr, ADC) ]
OLED Display 1306 I2C Board
OLED Display 1306 SPI Board
OLED RGB Display 1351 SPI Board (slow at this time)
LCD Display Nokia PCD8544 SPI 84×48
Realtime Clock DS3231(I2C)


Other functions:
===========

KeyMatrix support (with or without Digital I/O HAT | MCP 23017 chip)
Native USB Keyboard and Mouse Listener with “Device Grab” option
Changeable Boot-Logo, Boot-Animation
Rotary Encoder Support


I2C Sensors:
=========

Barometer BMP180 (+ Temperature)
Humidity HTU21D (+ Temperature)
Luxmeter TSL2561
UVmeter SI1145



Library Functions:
============

void pinMode(Pin, Direction);
void pullUpMode(Pin,Mode);

int digitalRead(Pin);
void digitalWrite(Pin, State);

int analogRead(ADC)
int analogReadExt(I2C-Port, I2C-Addr, ADC)

void setHardPWMFrequency(PWM, Frequency)
void setHardPWMPulseWidth(PWM, PulseWidth)

void setSoftPWMFrequency(Pin, Frequency)
void setSoftPWMPulseWidth(Pin, PulseWidth)

void startSerial(Baudrate);
void sendSerialLine(String)
boolean serialDataAvailable()
String serialReadLine()

void setInterrupt(Pin, Mode, Callback)
void removeInterrupt(Pin)

void startServoHat(I2C-Addr, Frequency);
void setHatServo(I2C-Addr, Channel, PulseWidth);
void hatServosOff(I2C-Addr);

void startMotorHat(I2C-Addr, Frequency);

class Motor(ODLib odLib, byte IC2Address, int motorNr)
void setDirection(int direction)
void setSpeed(int speed)

class Stepper(ODLib odLib, byte IC2Address, int motorNr, int stepsPerRevolution)
void setSpeed(int rpm)
void doSteps(int steps, int direction, int stepStyle)

class LCDDisplay1602(ODLib odLib, byte IC2Address)
void lcdON()
void lcdOFF()
void setTextVisible(boolean enable)
void setColors(int color)
void clearDisplay()
void setCursorPosition(int column, int row)
void setCursorEnabled(boolean enable)
void setBlinkEnabled(boolean enable)
void printText(String str, int xPos, int yPos)
void scrollDisplay(int direction)
int isButtonPressed()

class OLEDDisplay1306IC2(ODLib odLib, int IC2Port, byte IC2Address, int width, int height, boolean flipDisplay)
Canvas getCanvas()
int getWidth()
int getHeight()
void clearDisplay()
void updateDisplay()

class OLEDDisplay1306SPI(ODLib odLib, int width, int height, int mosiPin, int clkPin, int csPin, int rstPin, int dcPin, boolean flipDisplay)
Canvas getCanvas()
int getWidth()
int getHeight()
void clearDisplay()
void updateDisplay()

public OLEDColorDisplay1351SPI(ODLib odLib, int width, int height, int mosiPin, int clkPin, int csPin, int rstPin, int dcPin, boolean flipDisplay) {
Canvas getCanvas()
int getWidth()
int getHeight()
void clearDisplay()
void updateDisplay()

class LCDNokiaPCD8544SPI(ODLib odLib, int mosiPin, int clkPin, int csPin, int rstPin, int dcPin, boolean flipDisplay, int contrast)
Canvas getCanvas()
int getWidth()
int getHeight()
void clearDisplay()
void updateDisplay()

class DigitalIO(ODLib odLib, int IC2Port, byte IC2Address)
void pinMode(int pin, int direction)
int digitalRead(int pin)
void digitalWrite(int pin, int state)

class KeyMatrix(ODLib odLib, DigitalIOExt digitalIOExt, int[] colPins,int[] rowPins, int[][] keyCodes, String[][] keyChars, KeyEventListener listener)
void start()
void onDestroy()

class RotaryEncoder(odLib, encoderPinA_CLK,encoderPinB_DIR, buttonPin, encoderCallback);


void activateKeyboardListener(KeyboardEventListener keyboardEventListener, int grab)
void deactivateKeyboardListener()
void keyboardEvent(int keyCode, int state)

void activateMouseListener(MouseEventListener mouseEventListener, int grab)
void deactivateMouseListener()
void mouseMoveEvent(int x, int y)
void mouseButtonEvent(int mouseButton, int state)
void mouseWheelEvent(int wheelValue)

class I2CRTC3231(ODLib odLib, int IC2Port)
class I2CUVmeterSI1145(ODLib odLib, int IC2Port)
class I2CLuxmeterTSL2561(ODLib odLib, int IC2Port)
class I2CHumidityHTU21D(ODLib odLib, int IC2Port)
class I2CBarometerBMP180(ODLib odLib, int IC2Port)


// I2C-Port: I2C Port 1 or 2 | I2C-Addr: I2C Address (byte) | Reg-Addr: I2C Register (byte) | Byte: byte | Word: 2 bytes | Data: byte array

int checkI2CBusAddress(I2C-Port, I2C-Addr)
void sendI2CBusByte(I2C-Port, I2C-Addr, Byte)
void sendI2CBusWord(I2C-Port, I2C-Addr, Integer)
void sendI2CBusData(I2C-Port, I2C-Addr, Data, Len)
void sendI2CRegByte(I2C-Port, I2C-Addr, Reg-Addr, byte value)
void sendI2CRegWord(I2C-Port, I2C-Addr, Reg-Addr, int value)
void sendI2CRegData(I2C-Port, I2C-Addr, Reg-Addr, Data, Len)
int receiveI2CBusByte(I2C-Port, I2C-Addr)
int receiveI2CBusWord(I2C-Port, I2C-Addr)
int receiveI2CBusData(I2C-Port, I2C-Addr, Data, Len)
int receiveI2CRegByte(I2C-Port, I2C-Addr, Reg-Addr)
int receiveI2CRegWord(I2C-Port, I2C-Addr, Reg-Addr)
int receiveI2CRegData(I2C-Port, I2C-Addr, Reg-Addr, Data, Len)

void sendSPIBusData(int BIT_ORDER, int mosiPin, int clkPin, byte[] bytes, int len):
Attachments
HeaderPinsTemplatePrintable.pdf
(406.16 KiB) Downloaded 143 times
HeaderPinsTemplatePrintable_Single_HighResolution.pdf
(353.85 KiB) Downloaded 146 times
Last edited by TrippleAAA on Sat Jul 30, 2016 6:24 am, edited 156 times in total.
TrippleAAA
 
Posts: 237
Joined: Mon Jun 13, 2016 4:57 am
languages_spoken: english

Re: THANKS: Best Android/Arduino Board since Years

Unread postby odroid » Mon Jun 13, 2016 10:22 am

Thank you for the very positive feedback.
I'll forward your sweet comments and your wish list for the next ODROIDs to our development team.

Can you tell me what is your major application? what do you want to make?
User avatar
odroid
Site Admin
 
Posts: 29098
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: THANKS: Best Android/Arduino Board since Years

Unread postby TrippleAAA » Mon Jun 13, 2016 10:44 am

Robots with Android/Arduino only.

I need a Motor Shield for the ODROID.
Last edited by TrippleAAA on Mon Jun 20, 2016 9:27 pm, edited 3 times in total.
TrippleAAA
 
Posts: 237
Joined: Mon Jun 13, 2016 4:57 am
languages_spoken: english

Re: THANKS: Best Android/Arduino Board since Years

Unread postby TrippleAAA » Mon Jun 13, 2016 11:31 am

I've found this:

Adafruit 16-Channel PWM- / Servo-HAT for Raspberry

and this

Adafruit Stepmotor HAT for Raspberry Pi

This is what I was searching for.


At this time I need support for my Dell 24" TouchScreen USB support (Dell P2314T)
Then it would be possible to create a game table, for my own table games.
Last edited by TrippleAAA on Mon Jun 20, 2016 8:31 pm, edited 1 time in total.
TrippleAAA
 
Posts: 237
Joined: Mon Jun 13, 2016 4:57 am
languages_spoken: english

Re: THANKS: Best Android/Arduino Board since Years

Unread postby odroid » Mon Jun 13, 2016 12:02 pm

The VID/PID for P2314T was already included in the C2 Android kernel. If it doesn't work, it might not be compatible.
https://github.com/hardkernel/linux/blo ... ds.h#L1018
Unplug and plug the USB cable and let me know the result.
User avatar
odroid
Site Admin
 
Posts: 29098
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: THANKS: Best Android/Arduino Board since Years

Unread postby TrippleAAA » Mon Jun 13, 2016 1:05 pm

Oh, ... I did the USB unplug/plug thing yesterday and it wasn't working... but, I've tested it now again, and its working. Don't know why. Thanks.

Perfect.

ODroid C2 is a really awesome product. Keep up the good Android support!
TrippleAAA
 
Posts: 237
Joined: Mon Jun 13, 2016 4:57 am
languages_spoken: english

Re: THANKS: Best Android/Arduino Board since Years

Unread postby odroid » Mon Jun 13, 2016 1:10 pm

Thank you for the confirmation.
We will release another update within 48 hours to fix the random USB detection problem. ;)
We are adding a USB hub hard-reset function now.
That issue has existed on our Vu7+ too.
User avatar
odroid
Site Admin
 
Posts: 29098
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: THANKS: Best Android/Arduino Board since Years

Unread postby TrippleAAA » Mon Jun 13, 2016 1:13 pm

Thanks.
Last edited by TrippleAAA on Mon Jun 13, 2016 2:06 pm, edited 2 times in total.
TrippleAAA
 
Posts: 237
Joined: Mon Jun 13, 2016 4:57 am
languages_spoken: english

Re: THANKS: Best Android/Arduino Board since Years

Unread postby TrippleAAA » Mon Jun 13, 2016 2:04 pm

I've found an USB plug/unplug bug.

The app shown on the screen will be destroyed and restarted if you plug/unplug the USB Touchscreen cable (only the Touchscreen, not with the USB Mouse or USB Camera). If the app is hidden (in the background and not visible), then the app will be not destroyed and restarted.
TrippleAAA
 
Posts: 237
Joined: Mon Jun 13, 2016 4:57 am
languages_spoken: english

Re: THANKS: Best Android/Arduino Board since Years

Unread postby TrippleAAA » Wed Jun 15, 2016 1:03 am

I needed some time to complete the library.

I will support soon the Adafruit Motor + Servo Hat Boards (I2C), then it's possible to do all the things what you can do with an Arduino Motor Shield and Servo Shield... under Android :)
Last edited by TrippleAAA on Mon Jun 20, 2016 6:59 pm, edited 1 time in total.
TrippleAAA
 
Posts: 237
Joined: Mon Jun 13, 2016 4:57 am
languages_spoken: english

Re: THANKS: Best Android/Arduino Board since Years

Unread postby odroid » Wed Jun 15, 2016 10:10 am

Thank you for sharing the nice library.
Once you complete the test of I2C servo control, please consider writing an article for our Magazine.
The title can be "Embedded Android system for real hardware control" or something like that. :)

Try the latest V1.7 image to check the random USB enumeration bug fix.
http://odroid.com/dokuwiki/doku.php?id= ... _note_v1.7
User avatar
odroid
Site Admin
 
Posts: 29098
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: THANKS: Best Android/Arduino Board since Years

Unread postby TrippleAAA » Wed Jun 15, 2016 8:26 pm

Thanks I will test it tomorrow.

A question: It is possible that you implement a "Slow Down" Switch in Android to use the board "without the heatsink"?
Because I need the board a little "lighter" for my smaller biped robot. For that I don't need the Graphics Chip Mali 450 MP3.

Or could you release a "light" Odroid C2 Board without Ethernet, without Heatsink, and with only 2x USB Ports?

That would be nice.
Last edited by TrippleAAA on Wed Jun 15, 2016 9:07 pm, edited 1 time in total.
TrippleAAA
 
Posts: 237
Joined: Mon Jun 13, 2016 4:57 am
languages_spoken: english

Re: THANKS: Best Android/Arduino Board since Years

Unread postby odroid » Wed Jun 15, 2016 8:38 pm

If you limit the max CPU clock freq at 800~900Mhz, you can remove the heatsink probably.

But the performance should be lower than C1+/C0 and you can consider the C0 board for your application.
http://www.hardkernel.com/main/products ... 5326484280

PCB customization is not so simple because we must make 20,000pcs boards for a single production batch at least.
Otherwise the price of ODROID should be much higher.
User avatar
odroid
Site Admin
 
Posts: 29098
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: THANKS: Best Android/Arduino Board since Years

Unread postby TrippleAAA » Wed Jun 15, 2016 8:43 pm

Oh, the C0 looks nice.

Is Android 5.1 for the C0 available? I didn't found it in the download section.
Last edited by TrippleAAA on Wed Jun 15, 2016 10:25 pm, edited 3 times in total.
TrippleAAA
 
Posts: 237
Joined: Mon Jun 13, 2016 4:57 am
languages_spoken: english

Re: THANKS: Best Android/Arduino Board since Years

Unread postby odroid » Wed Jun 15, 2016 8:48 pm

User avatar
odroid
Site Admin
 
Posts: 29098
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: THANKS: Best Android/Arduino Board since Years

Unread postby TrippleAAA » Wed Jun 15, 2016 8:50 pm

C0: Hmm, I also think that the C0 has other ports identifier IDs (105/205) like the C1. Not compatible with the Android Library. I could change the Library... but this is not good for the continuity. You should try not to change the internal ports/pins in the future.

How I can slow down the C2 to 800/900 Mhz? Because then I will remove the other ports (Ethernet, USB)... then I have a "light" C2 with Android 5.1.1
Last edited by TrippleAAA on Wed Jun 15, 2016 10:24 pm, edited 1 time in total.
TrippleAAA
 
Posts: 237
Joined: Mon Jun 13, 2016 4:57 am
languages_spoken: english

Re: THANKS: Best Android/Arduino Board since Years

Unread postby tobetter » Wed Jun 15, 2016 9:02 pm

TrippleAAA wrote:Thanks.

How I can slow down the C2 to 800/900 Mhz? Because then I will remove the other ports (Ethernet, USB)... then I have a "light" C2 with Android 5.1.1

Why don't you try to run ODROID Utility on C2 Android? There is a tab where you can change default CPU frequency.
http://odroid.com/dokuwiki/lib/exe/deta ... -43-39.png
User avatar
tobetter
 
Posts: 2557
Joined: Mon Feb 25, 2013 10:55 am
Location: Paju, South Korea
languages_spoken: Korean, English
ODROIDs: X, X2, U2, U3, XU3, C1

Re: THANKS: Best Android/Arduino Board since Years

Unread postby TrippleAAA » Wed Jun 15, 2016 9:02 pm

Oh, yes... thanks :)
TrippleAAA
 
Posts: 237
Joined: Mon Jun 13, 2016 4:57 am
languages_spoken: english

Re: THANKS: Best Android/Arduino Board since Years

Unread postby TrippleAAA » Wed Jun 15, 2016 10:30 pm

About C0,C1,C2

Hardkernel: you should make available the same Android versions for all your boards, with the same internal and external pins.
The incompatibilities are sometimes often create insurmountable hurdles.

I know it's hard to hear, but this would make you different against all other manufaturers.

The incompatibilities are the reasons why I will use the C2 (not the C0) and slow down the SOC to 800 Mhz... I don't want to change anything, I don't want think about it, I want to use all my power for creativity, not to fix all the incompatibilities :)
Last edited by TrippleAAA on Thu Jun 16, 2016 12:04 am, edited 2 times in total.
TrippleAAA
 
Posts: 237
Joined: Mon Jun 13, 2016 4:57 am
languages_spoken: english

Re: THANKS: Best Android/Arduino Board since Years

Unread postby odroid » Wed Jun 15, 2016 10:34 pm

We really want that too. But it is really hard you know well. :(

Any specific APIs in Android 5.x you need?
User avatar
odroid
Site Admin
 
Posts: 29098
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: THANKS: Best Android/Arduino Board since Years

Unread postby TrippleAAA » Wed Jun 15, 2016 10:42 pm

;)

I know, but be Apple... make the impossible possible.

It should be irrelevant what I need from Android 5.1 ... the difference is that I know that there are no differences if it's the same Android version. It starts with the camera, the Camera Libraries for KitKat and Lollipop are different (really annoying)... and much more, so it's better to don't think about it... if you had anywhere Android 5.1

That's the reason why I've written that.
Last edited by TrippleAAA on Mon Jun 20, 2016 8:33 pm, edited 1 time in total.
TrippleAAA
 
Posts: 237
Joined: Mon Jun 13, 2016 4:57 am
languages_spoken: english

Re: THANKS: Best Android/Arduino Board since Years

Unread postby TrippleAAA » Sat Jun 18, 2016 3:22 pm

Library Done.

Take a look on the first post.
Last edited by TrippleAAA on Tue Jun 21, 2016 10:36 am, edited 2 times in total.
TrippleAAA
 
Posts: 237
Joined: Mon Jun 13, 2016 4:57 am
languages_spoken: english

Re: THANKS: Best Android/Arduino Board since Years

Unread postby TrippleAAA » Mon Jun 20, 2016 7:57 pm

I've removed the Heatsink and switched the CPU Clock Frequency with the Android ODROID Utility to 1 Mhz (Mode: "hotplug"), also I removed the big double USB port and the Ethernet Port (lower weight for the copter).

Power consumption: 1,5 Watt (before: 3,5 Watts with HDMI Monitor)
Temperature: 37°C
Weight: 24 grams (before 56 grams)


Also you can remove the ethernet port. With the reduced weight you can use the board for small copters, and with the low power consumption for a 24h/day application-server.
.
Attachments
IMG_20160621_010044719.jpg
IMG_20160620_130053675.jpg
IMG_20160619_081216902.jpg
IMG_20160620_131159288.jpg
Last edited by TrippleAAA on Tue Jun 21, 2016 8:06 am, edited 2 times in total.
TrippleAAA
 
Posts: 237
Joined: Mon Jun 13, 2016 4:57 am
languages_spoken: english

Re: ODLib for: Servos, Motors, I2C, Digital I/O, PWM

Unread postby keithphw » Mon Jun 20, 2016 11:42 pm

Impressive projects and photos, thanks for the inspiration.
keithphw
 
Posts: 62
Joined: Sat Mar 26, 2016 9:59 am
languages_spoken: english
ODROIDs: c2

Re: ODLib for: Servos, Motors, I2C, Digital I/O, PWM

Unread postby TrippleAAA » Tue Jun 21, 2016 6:17 am

You're welcome.
TrippleAAA
 
Posts: 237
Joined: Mon Jun 13, 2016 4:57 am
languages_spoken: english

Re: ODLib for: Servos, Motors, I2C, Digital I/O, PWM

Unread postby odroid » Tue Jun 21, 2016 8:26 am

Has been changed to "STICKY" because this ODLib must be useful for many Embedded applications based on Android.
User avatar
odroid
Site Admin
 
Posts: 29098
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: ODLib for: Servos, Motors, I2C, Digital I/O, PWM

Unread postby TrippleAAA » Tue Jun 21, 2016 10:25 am

odroid wrote:Has been changed to "STICKY" because this ODLib must be useful for many Embedded applications based on Android.


Gamechanger... definitely for me. Now I don't need Arduino for 95% of my projects, because why I should programming for 2 worlds, when I can do it all with Android? And the costs are the same: Arduino Mega/DUE 40€ + MotorShield 30€ = 70€ (ODROID C2 50€ + Motor HAT 22€ = 72€ ). Only for the small copter like the Blade Inductrix I need a Teensy LC, because Hardkernel do not produce very small headless boards like Teensy LC or Arduino Pro Micro.
Last edited by TrippleAAA on Tue Jun 21, 2016 2:12 pm, edited 3 times in total.
TrippleAAA
 
Posts: 237
Joined: Mon Jun 13, 2016 4:57 am
languages_spoken: english

Re: ODLib for: Servos, Motors, I2C, Digital I/O, PWM

Unread postby TrippleAAA » Tue Jun 21, 2016 1:21 pm

Updated to version 4: fixed pinMode & digitalWrite
TrippleAAA
 
Posts: 237
Joined: Mon Jun 13, 2016 4:57 am
languages_spoken: english

Re: ODLib for: Servos, Motors, I2C, Digital I/O, PWM

Unread postby TrippleAAA » Tue Jun 21, 2016 1:38 pm

It would be nice to release a new ODROID Board with more pins. More Digital and Analog pins. But please be compatible against the C2.
One version with soldered Ports (USB / Ethernet)... and one version without soldered ports (then I do not need to brutal cut off the ports :)

With more pins I could use the digital pins to connect the original C64 Keyboard and also connect the old Atari Joysticks, finally run an emulator. This would be a "One Board solution". I did it a few month before with a Banana PI with Android + Arduino DUE: Keyboard, Joysticks (before that: Banana Pi with Android: C64Emulator + Arduino Leonardo: Keyboard and USB Gameport Adapter: Joysticks)

Also faster Android boot time would be nice (< 5-10 seconds, I'm using an U1 Mode SDCard and it needs ~25 seconds, eMMC is complicated, I like SDCards).

I think the C2 is perfect and universal usable: fast Graphics (if you need it), Powerful CPU (if you need it), Low Power Consumption (if you need it), USB Webcam, and connections Pins. Last but not least: Android that works. I don't know what I should wish further more. There is nothing.

But everything stands or falls with a perfect working Android.
Attachments
admin-ajax.php.jpeg
(17.76 KiB) Downloaded 4550 times
IMG_20160107_033309239.jpg
IMG_20151222_201520079.jpg
(409.15 KiB) Downloaded 4550 times
TrippleAAA
 
Posts: 237
Joined: Mon Jun 13, 2016 4:57 am
languages_spoken: english

Re: ODLib for: Servos, Motors, I2C, Digital I/O, PWM

Unread postby odroid » Tue Jun 21, 2016 2:11 pm

There are 25 digital IOs and 2 ADC inputs on 40pin header.
There are additional 5 digital IOs on 7pin header.
http://odroid.com/dokuwiki/doku.php?id= ... connectors
30 digital GPIOs should be enough to handle your C64 keyboard matrix and Joystick buttons.
How many IOs do you need more?

I think there are 5~6 unused(not exposed) IOs on the S905 CPU BGA. But it is very hard to find a place to add more header pins.
User avatar
odroid
Site Admin
 
Posts: 29098
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: ODLib for: Servos, Motors, I2C, Digital I/O, PWM

Unread postby TrippleAAA » Tue Jun 21, 2016 2:17 pm

Nice, thats enough, but there are no Export GPIO# numbers like 205,206,249, ...

How I can reach the pins programmatically?
TrippleAAA
 
Posts: 237
Joined: Mon Jun 13, 2016 4:57 am
languages_spoken: english

Re: ODLib for: Servos, Motors, I2C, Digital I/O, PWM

Unread postby odroid » Tue Jun 21, 2016 2:40 pm

We will update the WiKi page by tomorrow. Sorry for the inconvenience caused. :o
User avatar
odroid
Site Admin
 
Posts: 29098
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: ODLib for: Servos, Motors, I2C, Digital I/O, PWM

Unread postby TrippleAAA » Tue Jun 21, 2016 2:43 pm

No problem.
TrippleAAA
 
Posts: 237
Joined: Mon Jun 13, 2016 4:57 am
languages_spoken: english

Re: ODLib for: Servos, Motors, I2C, Digital I/O, PWM

Unread postby crossover » Tue Jun 21, 2016 4:17 pm

TrippleAAA wrote:It would be nice to release a new ODROID Board with more pins. More Digital and Analog pins. But please be compatible against the C2.
One version with soldered Ports (USB / Ethernet)... and one version without soldered ports (then I do not need to brutal cut off the ports :)

With more pins I could use the digital pins to connect the original C64 Keyboard and also connect the old Atari Joysticks, finally run an emulator. This would be a "One Board solution". I did it a few month before with a Banana PI with Android + Arduino DUE: Keyboard, Joysticks (before that: Banana Pi with Android: C64Emulator + Arduino Leonardo: Keyboard and USB Gameport Adapter: Joysticks)

Also faster Android boot time would be nice (< 5-10 seconds, I'm using an U1 Mode SDCard and it needs ~25 seconds, eMMC is complicated, I like SDCards).

I think the C2 is perfect and universal usable: fast Graphics (if you need it), Powerful CPU (if you need it), Low Power Consumption (if you need it), USB Webcam, and connections Pins. Last but not least: Android that works. I don't know what I should wish further more. There is nothing.

But everything stands or falls with a perfect working Android.



Believe or not, the eMMC gives you much better user experience with Android. I feel it seems 2~3 times faster than my Class10 cards.
Anyway please share a how-to guide once you make your C64 project with 64bit C2 platform without any Arduino board. I am also interested in GPIO tinkering with Android SDK.
But the Keyboard emulation driver with GPIOs on the 40pin looks quite complicated. A uinput driver usage in Android service might be a hurdle.
crossover
 
Posts: 113
Joined: Wed Jul 22, 2015 2:23 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, USB-IO, HC2, Tinkering kits

Re: ODLib for: Servos, Motors, I2C, Digital I/O, PWM

Unread postby TrippleAAA » Tue Jun 21, 2016 10:14 pm

eMMC: maybe, but I don't like complicated things, and the only thing I need is the boot up time. The general performance of the SDCard is good enough for me.

uinput: would not be a problem, but I think you don't need it. I will see it in the next days, after I will get the export GPIO# numbers.
TrippleAAA
 
Posts: 237
Joined: Mon Jun 13, 2016 4:57 am
languages_spoken: english

Re: ODLib for: Servos, Motors, I2C, Digital I/O, PWM

Unread postby TrippleAAA » Wed Jun 22, 2016 3:05 am

odroid wrote:We will update the WiKi page by tomorrow. Sorry for the inconvenience caused. :o


Thanks, I've seen you've updated the Wiki Page, but none of the GPIO# pins 128,130,132,131,133 is working with the ODROID C2 Board:

2 GPIOAO.BIT6 I2S Data Input, Export GPIO#128 2mA
4 GPIOAO.BIT8 I2S MCLK, Export GPIO#130 2mA
5 GPIOAO.BIT10 I2S LRCLK, Export GPIO#132 2mA
6 GPIOAO.BIT9 I2S SCLK, Export GPIO#131 2mA
7 GPIOAO.BIT11 I2S Data Output, Export GPIO#133 2mA

all other pins 249,247,248 ,... are working fine.

Maybe the pin numbers are wrong (from the C1?) ?

Or an issue with "echo 133 > /sys/class/gpio/export" ? Because there is no gpio133 file in "/sys/class/gpio"
TrippleAAA
 
Posts: 237
Joined: Mon Jun 13, 2016 4:57 am
languages_spoken: english

Re: ODLib for: Servos, Motors, I2C, Digital I/O, PWM

Unread postby odroid » Wed Jun 22, 2016 10:02 am

It works with Ubuntu/Linux at this moment.

Android system uses the HDMI audio device and the I2S/SPDIF sound device at the same time.
So we need to change the Android audio HAL software. It may take very long time.
We will try to find a simpler way.
User avatar
odroid
Site Admin
 
Posts: 29098
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: ODLib for: Servos, Motors, I2C, Digital I/O, PWM

Unread postby TrippleAAA » Wed Jun 22, 2016 12:04 pm

Ok.
TrippleAAA
 
Posts: 237
Joined: Mon Jun 13, 2016 4:57 am
languages_spoken: english

Re: ODLib for: Servos, Motors, I2C, Digital I/O, PWM

Unread postby odroid » Wed Jun 22, 2016 1:34 pm

Comment out below two lines in the device-tree and compile it to a dtb file.
https://github.com/hardkernel/linux/blo ... #L606-L607

You need to install the device tree compiler package on your Linux PC.
apt-get install device-tree-compiler

Download the dts file from github and edit it.

Compile it
dtc -O dtb -o ./meson64_odroidc2.dtb ./meson64_odroidc2.dts

and transfer it to dtb partition.
http://odroid.com/dokuwiki/doku.php?id= ... tion_table
User avatar
odroid
Site Admin
 
Posts: 29098
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: ODLib for: Servos, Motors, I2C, Digital I/O, PWM

Unread postby TrippleAAA » Wed Jun 22, 2016 2:14 pm

Thanks for your effort, but no :)

It should be an Out-Of-the-Box thing. If I would do this... then it would be also complicated like all the other boards.

Perfection like Apple, not confusion like Windows ;-)
TrippleAAA
 
Posts: 237
Joined: Mon Jun 13, 2016 4:57 am
languages_spoken: english

Re: ODLib for: Servos, Motors, I2C, Digital I/O, PWM

Unread postby odroid » Wed Jun 22, 2016 2:25 pm

Many multimedia-oriented people will complain everyday if we remove the I2S/SPDIF sound output out of the box. :D
I don't like to see a movie if there is no sound.
User avatar
odroid
Site Admin
 
Posts: 29098
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: ODLib for: Servos, Motors, I2C, Digital I/O, PWM

Unread postby TrippleAAA » Wed Jun 22, 2016 2:31 pm

No, do not remove the "I2S/SPDIF" support, that was not my idea, because that would make no sense :)

But if you release the next board, please place more pins on the board.
TrippleAAA
 
Posts: 237
Joined: Mon Jun 13, 2016 4:57 am
languages_spoken: english

Re: ODLib for: Servos, Motors, I2C, Digital I/O, PWM

Unread postby TrippleAAA » Thu Jun 23, 2016 10:13 am

I've ordered some other Raspberry HATs /Shields... so I will support a lot of additional Hardware out of the box with my Android ODLib.

- More Analog Pins
- More Digital Pins (with Input PullUPs)
- LCD Display
- Touch-Emulation
- Direct Kinect USB Access
TrippleAAA
 
Posts: 237
Joined: Mon Jun 13, 2016 4:57 am
languages_spoken: english

Re: ODLib for: Servos, Motors, I2C, Digital I/O, PWM

Unread postby TrippleAAA » Thu Jun 23, 2016 10:54 am

But the Keyboard emulation driver with GPIOs on the 40pin looks quite complicated. A uinput driver usage in Android service might be a hurdle.

The C64 Keyboard is working fine with 16 digital pins (8 external PullUp resistors), directly in the Android C64 Emulator... tested yesterday with the ODROID C2 with Android. So other hardware is not needed, only an ODroid C2.
TrippleAAA
 
Posts: 237
Joined: Mon Jun 13, 2016 4:57 am
languages_spoken: english

Re: ODLib for: Servos, Motors, I2C, Digital I/O, PWM

Unread postby odroid » Thu Jun 23, 2016 11:07 am

Did you change the C64 emulator source code to get the GPIO key input events? or made another input layer in Android eventhub HAL?
User avatar
odroid
Site Admin
 
Posts: 29098
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: ODLib for: Servos, Motors, I2C, Digital I/O, PWM

Unread postby TrippleAAA » Thu Jun 23, 2016 1:29 pm

Did you change the C64 emulator source code to get the GPIO key input events?

Yes. Also for the C64 Joysticks. For this I had to disable all I2C, PWM and Serial ports (not enough pins).
TrippleAAA
 
Posts: 237
Joined: Mon Jun 13, 2016 4:57 am
languages_spoken: english

Re: ODLib for: Servos, Motors, I2C, Digital I/O, PWM

Unread postby TrippleAAA » Thu Jun 23, 2016 4:08 pm

Added printable Pin-Template as PDF file.
Attachments
HeaderPinsTemplatePrintable.pdf
(406.16 KiB) Downloaded 291 times
HeaderPinsTemplatePrintable_Single_HighResolution.pdf
(353.85 KiB) Downloaded 281 times
IMG_20160627_061628029.jpg
IMG_20160623_085816453.jpg
Last edited by TrippleAAA on Mon Jun 27, 2016 9:33 pm, edited 4 times in total.
TrippleAAA
 
Posts: 237
Joined: Mon Jun 13, 2016 4:57 am
languages_spoken: english

Re: ODLib for: Servos, Motors, I2C, Digital I/O, PWM

Unread postby odroid » Thu Jun 23, 2016 5:16 pm

Nice!
Can I add the printable file and the picture on our WiKi page?
User avatar
odroid
Site Admin
 
Posts: 29098
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: ODLib for: Servos, Motors, I2C, Digital I/O, PWM

Unread postby TrippleAAA » Thu Jun 23, 2016 5:45 pm

Yes.
TrippleAAA
 
Posts: 237
Joined: Mon Jun 13, 2016 4:57 am
languages_spoken: english

Re: ODLib for: Servos, Motors, I2C, Digital I/O, PWM

Unread postby TrippleAAA » Fri Jun 24, 2016 12:37 pm

Updated to v5.2: Fixed: Stepper Motor Speed (RPM), Fixed: Interrupt Example
Last edited by TrippleAAA on Fri Jun 24, 2016 7:10 pm, edited 1 time in total.
TrippleAAA
 
Posts: 237
Joined: Mon Jun 13, 2016 4:57 am
languages_spoken: english

Next

Return to Android

Who is online

Users browsing this forum: No registered users and 9 guests