Heroduino's Content - Netduino Forums
   
Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.

Heroduino's Content

There have been 14 items by Heroduino (Search limited from 29-March 23)


By content type

See this member's

Sort by                Order  

#52279 Shortest time readable on interrupt

Posted by Heroduino on 22 August 2013 - 10:22 AM in Netduino Plus 2 (and Netduino Plus 1)

Hello Julien,

 

look this http://forums.netdui...h-class/However

 

You can call the ticks from netduino and calculate to microsecounds.

 

 

sincerely

Heroduino




#51477 HC-SR04 Ultrasonic Sensor Memory Problem

Posted by Heroduino on 16 July 2013 - 08:06 AM in Netduino Plus 2 (and Netduino Plus 1)

Hello Grant,

 

sorry. I had no try this. The other way is, before you return from Read() is clear the eventhandler

public static int Read(){   EchoPin.OnInterrupt += new NativeEventHandler(port_OnInterrupt);      EchoPin.DisableInterrupt();                         Distance();   Thread.Sleep(25);   EchoPin.OnInterrupt -= new NativeEventHandler(port_OnInterrupt);   return uDistance;}

Or you write a methode for allocate one time only the event handler.

 

Other Example

public static void SetEventInterupt(){      EchoPin.OnInterrupt += new NativeEventHandler(port_OnInterrupt);}public static int Read(){  EchoPin.DisableInterrupt();                         Distance();  Thread.Sleep(25);  return uDistance; }

And your main 'while' you write:

SetEventInterupt();while (true) {       lcd.Move(2, 0);       lcd.Show(Sonic.Read().ToString() + "cm ");       Thread.Sleep(1000); }

Or look on my blog and Translate my content. Well, I posted a example code. ^_^

http://meineweltinme...m-netduino.html

 

Heroduino




#51471 HC-SR04 Ultrasonic Sensor Memory Problem

Posted by Heroduino on 16 July 2013 - 05:00 AM in Netduino Plus 2 (and Netduino Plus 1)

Hello Grant,

 

if you used the Read() method, you allocate each time a new Event, but it dont clear it. Try this to the Methode.

public static int Read(){   if(EchoPin.OnInterrupt == null)   {      EchoPin.OnInterrupt += new NativeEventHandler(port_OnInterrupt);   }   EchoPin.DisableInterrupt();                         Distance();   //Debug.Print("distance = " + myDistance + " mm.");   Thread.Sleep(25);   return uDistance;}

Heroduino




#51217 MPU 6050 Data are not constant

Posted by Heroduino on 08 July 2013 - 04:47 PM in Netduino Plus 2 (and Netduino Plus 1)

Herllo Attila,

 

sorry, but I have not understand the DMP completely. The Sensor have many options to configurate and I have here presented a tiny example code for the sensor.

 

If you want use the raw data from the sensor, deaktivate some setting in the initialisation. To Comment out the Gyro_Config (0x1B) and the Accel_Config (0x1C).

 

On the page 5 is a description what the DMP going to do. ;)

http://www.invensens...M-MPU-6000A.pdf

 

 

 

Heroduino




#51120 MPU6050 with Netduino

Posted by Heroduino on 05 July 2013 - 05:29 PM in Project Showcase

Hallo Netduino Community,

 

I think it is time to post my example here in the Netduino Forum. My first post was in German, but I see many webcalls come from around the world and the google translater is not quite good at understanding my descriptions. Well, my English is very rusty. So, I am sorry for any mistakes I might (and will) make.

 

Last year, I bought the sensor MPU-6050 and at first I couldn't run it. I saw the code library in C++ and read how to function the sensor. It was not very helpful for me. But it helped me to understand the code from Jeff Rowbergs Librarys. The code is awesome, but unfortunately not for a quick understanding.

 

First half of the year, I succeeded to run my prorgam with the sensor and posted it on my blog for sharing. Later I wrote a short Version for arduino. It fitted on a page side ;)

 

Ok, what does my program do.

public class MPU6050Sensor{    // I²C Class for connecting to the sensor    private I2CDevice _i2CDevice;    // The Contructor initialized the connecting and the sensor    public MPU6050Sensor()    {        // I²C connecting:        // The first HEX value 0x68 is the address from the sensor and        // the value 100 is for the transmission speed.        // Well you can use 400kHz,        // if you have a clean cable connection.        _i2CDevice = new I2CDevice(new I2CDevice.Configuration(0x68, 100));        // Sensor init        // Sleep und Reset execute:        // The HEX value 0x6B is for the Power Management 1        // The secound Hex value includes the 'Bit' for reset.        StatusMessage(Write(new byte[] { 0x6B, 0x80 }));        Thread.Sleep(10);        // Stop sleep and Clock setup:        // The HEX value 0x6B is for the Power Management 1        // The secound Hex value 0x00 set the 'Clock Select'        // to 'Internal 8MHz oscillator'        // If you don't need the temperature sens,        // you can set the HEX value 0x08.        StatusMessage(Write(new byte[] { 0x6B, 0x00 }));        // Configuration setup:        // This Configuration activates the Low Pass Filter (DLPF).        // Setting => Acc=5Hz, Delay=19.0ms, Gyro=5Hz, Delay=18.6ms, Fs=1kHz        StatusMessage(Write(new byte[] { 0x1A, 0x06 }));    }    // Send a byte array to the sensor    private int Write(byte[] buffer)    {        I2CDevice.I2CTransaction[] transactions = new I2CDevice.I2CTransaction[]        {            I2CDevice.CreateWriteTransaction(buffer)        };        return _i2CDevice.Execute(transactions, 1000);    }    // Read a byte array the sensor results    private int Read(byte[] buffer)    {        I2CDevice.I2CTransaction[] transactions = new I2CDevice.I2CTransaction[]        {            I2CDevice.CreateReadTransaction(buffer)        };        return _i2CDevice.Execute(transactions, 1000);    }    // Give a status message of result    private void StatusMessage(int result)    {        if (result == 0)        {            Debug.Print("Status: Fehler beim Senden oder Empfangen");        }        else        {            Debug.Print("Status: OK");        }    }    // Call the object SensorData with the sensor result    public SensorData GetSensorData()    {        // Byte Array for reading        byte[] buffer = new byte[14];        buffer[0] = 0x3B;        // The HEX Value set the first byte        // of the acceleration axis X        Write(new byte[] { 0x3B });        // Read from the sensor        Read(buffer);        // Give the byte array result to the object,         // and convert it to usable values        return new SensorData(buffer);    }}

The last method shows the SensorData object class and how it Looks.

public class SensorData{    public uint Acceleration_X = 0;    public uint Acceleration_Y = 0;    public uint Acceleration_Z = 0;    public uint Temperatur = 0;    public uint Gyroscope_X = 0;    public uint Gyroscope_Y = 0;    public uint Gyroscope_Z = 0;    public SensorData(byte[] buffer)    {        // Result of the acceleration axis        Acceleration_X = (((uint)buffer[0]) << 8) | buffer[1];        Acceleration_Y = (((uint)buffer[2]) << 8) | buffer[3];        Acceleration_Z = (((uint)buffer[4]) << 8) | buffer[5];        // Restult of temperature        Temperatur = (((uint)buffer[6]) << 8) | buffer[7];        // Result of the gyroscope axis        Gyroscope_X = (((uint)buffer[8]) << 8) | buffer[9];        Gyroscope_Y = (((uint)buffer[10]) << 8) | buffer[11];        Gyroscope_Z = (((uint)buffer[12]) << 8) | buffer[13];    }}

The next part is to connect the hardware, before you can deploy. Netduino to Sensor 3.3V >> VCC GND  >> GND AnalogIn 4 >> SDA AnalogIn 5 >> SCL

At last, for the Main() Methode

public static void Main(){    MPU6050Sensor mpu = new MPU6050Sensor();    SensorData data = mpu.GetSensorData();    while (true)    {        data = mpu.GetSensorData();        Debug.Print(            "Acc X: " + data.Acceleration_X + " " +            "Acc Y: " + data.Acceleration_Y + " " +            "Acc Z: " + data.Acceleration_Z + " " +            "Gyro X: " + data.Gyroscope_X + " " +            "Gyro Y: " + data.Gyroscope_Y + " " +            "Gyro X: " + data.Gyroscope_Z + " " +            "Temperatur: " + data.Temperatur);    }}

Well, that is all and I hpoe you have fun :)

Greetings from Germany, have a nice weekend!!

 

 

 

Edit:

My reposting on my blog (Language German)

http://meineweltinme...en-mit-dem.html

Attached Files




#51118 MPU 6050 Data are not constant

Posted by Heroduino on 05 July 2013 - 04:19 PM in Netduino Plus 2 (and Netduino Plus 1)

Hello MoonWalker (Attila),

 

the elapsed time it is not necessary for filtering. For example you can progamming a attitude indicator with complemtary filtering without elapsed time. :)

 

What are you planing to do with this elapsed time?

 

 

 

Heroduino




#51089 HELP with servo on NP2

Posted by Heroduino on 04 July 2013 - 07:55 PM in Netduino Plus 2 (and Netduino Plus 1)

Hello again MrGringoPy,

 

perhaps, write it in code is sometime easier to understand  ;)

 

Module Module1   Sub Main()

  Dim pwm As New PWM(PWMChannels.PWM_PIN_D9, 20000, 1500, pwm.ScaleFactor.Microseconds, False)  

' First Position (Duration for 1.0ms)   pwm.Duration = 1000   Thread.Sleep(100)

 

' Middle Position (Duration for 1.5ms)   pwm.Duration = 1500   Thread.Sleep(100)

 

  ' Last Position (Duration for 2.0ms)   pwm.Duration = 2000   Thread.Sleep(100)

  End Sub

 

 

sincerely,

Heroduino End Module




#51079 HELP with servo on NP2

Posted by Heroduino on 04 July 2013 - 10:25 AM in Netduino Plus 2 (and Netduino Plus 1)

Hello MrGringoPy,

 

you need to change the duration. So you use only the value duration.

 

To Control the Servo, you can change the duration between 1000 to 2000 (1ms to 2ms). The periode have you set and so you don't need to change it. ;)

 

 

 

Heroduino




#50994 MPU 6050 Data are not constant

Posted by Heroduino on 01 July 2013 - 06:08 PM in Netduino Plus 2 (and Netduino Plus 1)

Hallo Alex,

 

I think the voltage is alright. :)

 

Yes, the constructor had the right initialization. So, I think you don't need to change it.

If you want to check the transmission, you will need an oscilloscope.

You can try an other clockrate. At normal setting, I used 100kHz. which can change to 400kHz.

 

Show all inits with status "OK"? If yes, that is a sign for "everything is ok". ;)

If you still have trouble, perhaps you may have a bad connection with SDA and SDO.

 

Sorry for my poor English, non-native speaker.

 

Heroduino




#50980 MPU 6050 Data are not constant

Posted by Heroduino on 01 July 2013 - 11:03 AM in Netduino Plus 2 (and Netduino Plus 1)

Hello alex,

 

comes the failur, after the initialisation? Well, that is a failur by a loose connection or bad contact.

 

Have you try it on a Breadboard? I have my sensor now soldered.

So, important is the initialisation sequenz in my example code must execute.

 

 

Heroduino




#50446 MPU 6050 Data are not constant

Posted by Heroduino on 12 June 2013 - 07:20 PM in Netduino Plus 2 (and Netduino Plus 1)

Hello Shadi,

 

sorry I see your message at now. But, I am not sure what your are try to descripte.

 

Well, you used the "InterruptPort" Class for what. The Sensor MPU6050 can only read by I²C.

 

 

And so I wonder me, I have not see the message from Vinh.

 

Hello Vinh,

 

why you convert to string and cast the value to int16? The value need a uint, or use a int or int32. So then it functions ;)

 

 

 

Heroduino




#49899 MPU 6050 Data are not constant

Posted by Heroduino on 24 May 2013 - 08:30 AM in Netduino Plus 2 (and Netduino Plus 1)

Hello Kamal Kumar Raj,

 

you don't tell the fail, if you run bei exampple code.

 

Well, you Need only my example solution. Not a extra library.

 

You Connect the Netduino to MPU6050

 

+5V Pin => VCC

Analog Pin4  => SDA

Analog Pin5  => SCL

GND Pin => GND

 

So need you more help, write a message again ;)

Or look on my Blogpost and use Google Translate ;)

http://meineweltinme...m-netduino.html

 

 

Heroduino




#47224 MPU 6050 Data are not constant

Posted by Heroduino on 15 March 2013 - 11:36 AM in Netduino Plus 2 (and Netduino Plus 1)

Hello,

 

i have found the problem and I have fixed.

For interest, I post my solution.

 

http://dl.dropbox.co...nsorEnglish.zip

 

 

Heroduino




#42078 MPU 6050 Data are not constant

Posted by Heroduino on 24 December 2012 - 04:00 AM in Netduino Plus 2 (and Netduino Plus 1)

Hallo,

for several days now I try to program with my Netduino plus to read values from the sensor MPU 6050.

So, i don't have any idea, it doesn`t work, what can i do? I have tried many configurations, without success.

Here is a result at the Moment, if I start to read:

Initialisiere den Beschleunigungs- und Gyrosensor MPU-6050
-----------------------------------------------------------------------
Status: OK
Status: OK
Status: OK
Status: OK
Verbindung testen:
Status: Error
-----------------------------------------------------------------------
Acceleration: X: 162 Y:43647 Z:64764 Gyro: X: 53751 Y: 30329 Z: 57686
Acceleration: X: 0 Y:65403 Z:31771 Gyro: X: 61390 Y: 65385 Z: 1442
Acceleration: X: 28752 Y:46264 Z:0 Gyro: X: 0 Y: 0 Z: 0
Acceleration: X: 0 Y:0 Z:0 Gyro: X: 0 Y: 0 Z: 0
Acceleration: X: 0 Y:0 Z:0 Gyro: X: 0 Y: 0 Z: 0
Acceleration: X: 1281 Y:59647 Z:31809 Gyro: X: 254 Y: 29182 Z: 61951
...


The Connections to the sensor, i have already tested.
So I hope anyone can help me :o


Heroduino

PS: Sorry for my bad English. <_<




home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.