Explain.
A serial of leds, will switch on and switch off continuously, in both directions, the delay between switch can be modified using two buttons.
An the delay value will send the cubieboard and displayed.
.....
void setup()
{
//Initiate the serial communications at the arduino
Serial.begin(115200);
//Digital pins for output
for (int x=0; x<5;x++)
{
pinMode(ledPin[x],OUTPUT);
}
// Digital pins for Input
pinMode(btnUP,INPUT);
pinMode(btnDOWN,INPUT);
changeTime =millis();
}
// Main program in a continuous loop
void loop()
{
if ((millis() -changeTime) > ledDelay)
{
changeLED();
changeTime= millis();
}
if (digitalRead(btnUP))
{
//Serial print will be part of a function to use a protocol
Serial.println(ledDelay++);
delay(20);
if (ledDelay >200) ledDelay =200;
}
...........
void changeLED()
{
//switch off all the leds
for (int x =0; x<5;x++)
{
digitalWrite(ledPin[x],LOW);
}
digitalWrite(ledPin[currentLed],HIGH);
currentLed += direction;
if (currentLed == 4) {direction = -1;}
if (currentLed == 0) {direction = 1;}
}
Note: In the "Serial.println(value) will be used to make a function to control the protocol between arduino and cubieboard
To see if the cubieboard can receive the data I use the information that I find here : http://linux-sunxi.org/Cubieboard/TTL
stty -F /dev/ttyS0 -crtscts cu -s 115200 -l /dev/ttyS0
I know that the circuit is very simple, and even one of the worst I've ever made, but is just to see the idea.
If any one has any idea, or doubt, please share, I made this to learn and share.
Hi, does the TTL UART on middle/top of the cubieboard directly plug into the Arduino TTL (5V UART)?
ReplyDeleteIs it also 5V? I thought it was all 3.3Volt on the cubieboard?
Hi cibu
DeleteYes I made the connection directly (Cubie.TX <--> Arduino.RX, cubi.RX <--> Arduino.TX)
I show the difference of two boards, but the TTL should works from 0 to 0.8 V to low levels, and from 2.4 V to Vcc to high levls.( I was afraid if I could damage the Cubie, but it works ok)
I know it's not the best way to make the connection, in the future, I'll try to correct the problem, or change to I2C communication.
Well, I also have the Cubie and Arduino, so I want to try the same things. So far I only connected the Cubie to the Ard.RX - but if you say the Cubie.RX is 5Volt tolerant. That is very good news. Did you try to use the I2C connectors to communicate yet? I was thinking about trying a direct USB<->USB (encaps.serial) that would be easy and safe. Have you tried that? Thank you for the two great Blogs!!!
DeleteHi cibu.
DeleteI've just tried to use the serial connection through the USB<->USB connection, at the first intent it doesn't work, cause the module usbserial (ftdi_sio) it wasn't insalled in my raspbian, you should check if you have it, if you want to use the serial communication
This module give us the USB -- Serial communication to the arduino.
I solved the problem upgrading the raspbian, I should to investigate more
Hi Cibu.
ReplyDeleteI dind't try to use the I2C connectors on the cubieboard, I used it only at the arduino to collect the data from clock, temperature, compass and pressure, and I'm going to send the information using the serial.
For the final prepossess I'm thinking to use directly the USB connection will be safe, and simple.
But I've to think it quite well cause I'm thinking to connect 2 arduinos to one cubieboard, and make it portable.
Thanks for reading, I hope to start to write again in the doingdrones.wordpress.com but I'm waiting to new material.
Hi,
ReplyDeleteWe are working on a project regarding cubie board. We are beginners in cubie board. We want to know which ardiuno board you used. Also we want to using these how we can construct a temperature control system with temperature sensor and a small fan using idea that when temperature increases fan gets on . Please please help us ...Please reply via mail to aswin.m.p@gmail.com
Hi
DeleteAs I see your project looks quite simple, and the cubieboard it's not necessary.
I use few different arduino. (arduino UNO, arduino pro (https://www.sparkfun.com/products/10915)
You have different options to collect the temperature in digital and analogical
Analogical : http://www.bricogeek.com/shop/sensores/346-sensor-de-temperatura-tmp36.html
digital: http://www.bricogeek.com/shop/sensores/41-sensor-de-temperatura-ds18b20-one-wire.html
or I2C = DS1621 (http://www.electronics-lab.com/blog/?tag=ds1621)
Hey Pablo,
ReplyDeleteIm using cubieboard2 and i want it to connect to arduino through python cos im parallely runnin a python program which s to send data to arduino. Im plannin to use pyserial lib.If ur used to python can u tell me wats the exact code to make a connection with arduino thru serial, or pls tell me the port no. of the tx rx pins in cubieboard2.. Thanks in advance....
Hi Ajith.
DeleteFirst thanks for reading.
With python is quite simple to communicate using serial, Cubieboard has 2 serial ports.
I'm using the first Serial port, you can see a diagram, here in a post of June.
For the serial port in Arduino I recommend the use of a software serial
To open the serial port in python is quite simple
....
import serial
......
....
ser = serial.Serial('/devt/ttyS0', 9600, timeout=1)
......
ser.close()
I hope it's the idea that you were looking for.