Information on NetduinoGo Shield Base Module - Page 2 - Netduino Go - 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.
Photo

Information on NetduinoGo Shield Base Module


  • Please log in to reply
31 replies to this topic

#21 carb

carb

    Advanced Member

  • Members
  • PipPipPip
  • 352 posts
  • LocationCrystal River, Florida

Posted 28 April 2012 - 01:29 AM

Steve,

The C# code looks good, after looking at it I noticed that I wasn't doing a very good job of adding comments to my code. I left them out to keep the paste sizes small. I assumed that most were way ahead of me. I the future I will try to add more comments so that other can tell what I was trying to do.

Tommorrow I am planning on adding 2 potentiometers 1 for stepoint, 1 for deadband. Plus a pair of relays for control of something 1 on high temperature 1 for low temperature. The relays are made by Denkovi and have a transistor driver on the board (with 3.3 vdc applyed they pull 300 microamps / .3 milliamp each).

Denkovi Relays

Chuck

Attached Files



#22 carb

carb

    Advanced Member

  • Members
  • PipPipPip
  • 352 posts
  • LocationCrystal River, Florida

Posted 29 April 2012 - 01:01 AM

I am currently driving 4 relays off of the shieldbase using digital I/O pins 0, 1, 2 & 3.

The problem that I have is that digital I/O_0 is true when power is applied to the Shield Base & Netduino Go main board (i.e. when I plug the USB in to the computer), the other 3 I/Os are false.

After the main board has completed booting the I/Os and relays go to the desired state provided in the code
Relay1 = New OutputPort(SB.Pins.GPIO_PIN_D0, False)
Relay2 = New OutputPort(SB.Pins.GPIO_PIN_D1, False)
Relay3 = New OutputPort(SB.Pins.GPIO_PIN_D2, False)
Relay4 = New OutputPort(SB.Pins.GPIO_PIN_D3, False)

Some where I read that the I/Os powered up in the false state, is this a firmware bug or another problem.


Chuck

#23 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 29 April 2012 - 07:03 AM

Hi Chuck,

Some where I read that the I/Os powered up in the false state, is this a firmware bug or another problem.

Good find.

All of the IOs except for D0/D1 should power up in the "no pullup/pulldown" state. Pins D0/D1 currently initialize as a serial debug port (for users who want to use their board as a NETMF target, and for debug purposes if there are any glitches with the Shield Base's Virtual IO C# app).

As the Shield Base leaves beta, we'll change both of these pins to default the same as the other pins.

Chris

#24 carb

carb

    Advanced Member

  • Members
  • PipPipPip
  • 352 posts
  • LocationCrystal River, Florida

Posted 29 April 2012 - 01:40 PM

Hi Chuck,

Good find.

All of the IOs except for D0/D1 should power up in the "no pullup/pulldown" state. Pins D0/D1 currently initialize as a serial debug port (for users who want to use their board as a NETMF target, and for debug purposes if there are any glitches with the Shield Base's Virtual IO C# app).

As the Shield Base leaves beta, we'll change both of these pins to default the same as the other pins.

Chris


Thats good to know, when do you think you will open the additional socket for the main board? With the shield base plugged in I have run out of sockets, DANG IT MAN, WE NEED MORE SOCKETS! (never mind if you were older you would understand). :blink:

I have run out and using the onboard push button.

Thanks,
Chuck

Attached Files



#25 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 29 April 2012 - 01:45 PM

Thats good to know, when do you think you will open the additional socket for the main board? With the shield base plugged in I have run out of sockets, DANG IT MAN, WE NEED MORE SOCKETS! (never mind if you were older you would understand). :blink:

:)

The current plan is to move the Shield Base to the SPI channel in May. We're finishing up the over-the-bus reflashing code now (for easy reflashing)...then we can work on a few updates to the Shield Base (the switch to SPI being the one I'm most excited about).

Chris

#26 carb

carb

    Advanced Member

  • Members
  • PipPipPip
  • 352 posts
  • LocationCrystal River, Florida

Posted 04 May 2012 - 03:52 PM

Chris,

I wanted to post the last code that I worked on along with included comments in the code. Is there a better place to do this (than in the forum), something like a code bank for Visual Basic?

I think it may help the community to have a one stop shop to locate code snippets.

The only problem that I see is that the firmware and hardware are still maturing, but at least with a code bank it could be updated as improvements came along.

Imports Microsoft.SPOT
Imports Microsoft.SPOT.Hardware
Imports SecretLabs.NETMF.Hardware
Imports SecretLabs.NETMF.Hardware.NetduinoGo
Imports Nwazet.Go.Display
Imports Nwazet.Go.Fonts
Imports NetduinoGo
Imports Nwazet.Go.Imaging
Imports Nwazet.Go.Display.TouchScreen
Imports GoBus

Namespace Basic_go_display

  Public Module Module1
    Dim canvas As VirtualCanvas
    Dim SB As ShieldBase
    Dim Led As RgbLed 'Provides Temperature Status
    Dim Pot1 As Potentiometer ' Setpoint
    Dim Pot2 As Potentiometer ' Deadband
    Dim Setpoint As Single = 0
    Dim Deadband As Single = 4.0
    Dim Relay1 As Microsoft.SPOT.Hardware.OutputPort ' First Stage Heating
    Dim Relay2 As Microsoft.SPOT.Hardware.OutputPort ' Second Stage Heating
    Dim Relay3 As Microsoft.SPOT.Hardware.OutputPort ' First Stage Cooling
    Dim Relay4 As Microsoft.SPOT.Hardware.OutputPort ' Second Stage Cooling
    Dim TempSensor As AnalogInput
    Public ReadOnly ColorBackground As UShort = CUShort(BasicColor.Blue)
    Dim lastTouchX As Integer
    Dim lastTouchY As Integer

    Sub Main()
      canvas = New VirtualCanvas(AddressOf TouchEventHandler, AddressOf WidgetClickedHandler)
      ' I specified the sockets that I was using because of the multiple pots etc.
      canvas.Initialize(GoSockets.Socket5)
      canvas.TouchscreenCalibration()
      SB = New ShieldBase(GoSockets.Socket2)
      Led = New RgbLed(GoSockets.Socket7)
      Pot1 = New Potentiometer(GoSockets.Socket6)
      Pot2 = New Potentiometer(GoSockets.Socket8)
      TempSensor = New AnalogInput(SB.AnalogChannels.ANALOG_0) ' TMP-36 sensor
      Relay1 = New OutputPort(SB.Pins.GPIO_PIN_D0, False)
      Relay2 = New OutputPort(SB.Pins.GPIO_PIN_D1, False)
      Relay3 = New OutputPort(SB.Pins.GPIO_PIN_D2, False)
      Relay4 = New OutputPort(SB.Pins.GPIO_PIN_D3, False)
      While True
        Setpoint = CSng(CInt(50 * Pot1.GetValue + 50.0)) ' Setpoint Range from 50.0 to 100.0 F., Whole Number Only
        Deadband = CSng(CInt(10 * Pot2.GetValue + 2.0)) ' Deaband Range from 2.0 to 12.0 F., Whole Number Only
        WriteTemperature(canvas, GetAverageTemperature)
        Thread.Sleep(1000) ' With the 1/2 averaging + write delay, update about every 2 seconds.
      End While
      canvas.Reboot()
      canvas.Dispose()
    End Sub

    ' The function GetTemperature uses a TMP36 sensor, 10 mV/°C, Low voltage operation (2.7 V to 5.5 V)
    ' Range of −40°C to +125°C
    Function GetTemperature() As Single ' Returns temperature in Celsius
      Dim voltage As Single = CSng(TempSensor.Read * 3.3)
      Return CSng((voltage - 0.5) * 100)
    End Function

    ' The function GetAverageTemperature takes 10 samples and averages them. 
    ' May not be necessary with Netduino Go, the AIO seems to be very stable.
    Function GetAverageTemperature() As Single
      Dim TotalTemp As Single = 0
      Dim AverageTemp As Single
      For i = 0 To 9 Step 1
        TotalTemp += GetTemperature()
        Thread.Sleep(50)
      Next
      AverageTemp = CSng(TotalTemp / 10)
      Return AverageTemp
    End Function

    ' I am not using this event handler, but is needed by the canvas declaration.
    ' You could use to adjust the setpoint and deadband instead of using a potentiometer.
    Public Sub TouchEventHandler(ByVal touchEvent As TouchEvent)
      Debug.Print("------------TouchEventHandler------------")
      Debug.Print("X: " & touchEvent.X.ToString)
      Debug.Print("Y: " & touchEvent.Y.ToString)
      Debug.Print("Pressure: " & touchEvent.Pressure.ToString)
      lastTouchX = touchEvent.X
      lastTouchY = touchEvent.Y
    End Sub

    Public Sub WidgetClickedHandler(ByVal widget As Widget, ByVal touchEvent As TouchEvent)
    End Sub

    Public Sub WriteTemperature(ByVal canvas As VirtualCanvas, ByVal CTemp As Single)
      Dim fontInfo = New Verdana14
      Dim FTemp As Single = CTemp * 9 / 5 + 32 ' Converts to Farenheit
      Dim KTemp As Single = CTemp + CSng(273.15) ' Converts to Kelvin (Absolute Temperature Scale)
      Dim RTemp As Single = FTemp + CSng(459.67) ' Converts to Rankine (Absolute Temperature Scale)
      Dim DT As Date = Date.Now ' Reads internal clock, Current Date / Time is not set, No RTC
      Dim FString As String = "Farenheit = " + FTemp.ToString("N1") ' Creates String with 1 decimal place
      Dim CString As String = "Celsius = " + CTemp.ToString("N1")
      Dim KString As String = "Kelvin = " + KTemp.ToString("N1")
      Dim RString As String = "Rankine = " + RTemp.ToString("N1")
      Dim i As Integer = 0
      canvas.DrawFill(CUShort(ColorBackground))
      ' The Netduino Go does not have a Real Time Clock that is currently available for use.
      ' The date / time are started at power up at 6/01/2011 0:00:00
      ' I put it in so that I could see the update rate etc.
      canvas.DrawString(10, 10, CUShort(BasicColor.White), Verdana14.ID, DT.ToString)
      canvas.DrawString(10, 50, CUShort(BasicColor.Green), Verdana14.ID, "Setpoint = " + Setpoint.ToString("N1"))
      canvas.DrawString(10, 80, CUShort(BasicColor.Green), Verdana14.ID, "Deadband = " + Deadband.ToString("N1"))
      canvas.DrawString(10, 120, CUShort(BasicColor.White), Verdana14.ID, FString)
      canvas.DrawString(10, 150, CUShort(BasicColor.White), Verdana14.ID, CString)
      canvas.DrawString(10, 180, CUShort(BasicColor.White), Verdana14.ID, KString)
      canvas.DrawString(10, 210, CUShort(BasicColor.White), Verdana14.ID, RString)
      ' I am used to working mainly with Farenheit scale, hense FTemp was used
      ' to determine trip point for the relays, I added 4 relays because that is
      ' what I had on hand. You can add 16 using just the DIOs on 1 shield base
      ' more if you what to use the left over AIO also.
      If FTemp < (Setpoint - Deadband) Then ' Determines Heating / Cooling modes
        i = 1
      ElseIf FTemp < (Setpoint - Deadband / 2) Then
        i = 2
      ElseIf FTemp > (Setpoint + Deadband) Then
        i = 4
      ElseIf FTemp > (Setpoint + Deadband / 2) Then
        i = 3
      End If
      ' The Select Case controls the relays and the RGB Led.
      ' I also sends a status message to the display.
      Select Case i
        Case 1
          Led.SetColor(0, 0, 255) ' Brite Blue
          Relay1.Write(True)
          Relay2.Write(True)
          Relay3.Write(False)
          Relay4.Write(False)
          canvas.DrawString(10, 250, CUShort(BasicColor.White), Verdana14.ID, "Stage 2 Heating")
        Case 2
          Led.SetColor(0, 0, 50) ' Dim Blue
          Relay1.Write(True)
          Relay2.Write(False)
          Relay3.Write(False)
          Relay4.Write(False)
          canvas.DrawString(10, 250, CUShort(BasicColor.White), Verdana14.ID, "Stage 1 Heating")
        Case 3
          Led.SetColor(50, 0, 0) ' Dim Red
          Relay1.Write(False)
          Relay2.Write(False)
          Relay3.Write(True)
          Relay4.Write(False)
          canvas.DrawString(10, 250, CUShort(BasicColor.White), Verdana14.ID, "Stage 1 Cooling")
        Case 4
          Led.SetColor(255, 0, 0) ' Brite Red
          Relay1.Write(False)
          Relay2.Write(False)
          Relay3.Write(True)
          Relay4.Write(True)
          canvas.DrawString(10, 250, CUShort(BasicColor.White), Verdana14.ID, "Stage 2 Cooling")
        Case Else
          Led.SetColor(0, 255, 0) ' Brite Green
          Relay1.Write(False)
          Relay2.Write(False)
          Relay3.Write(False)
          Relay4.Write(False)
          canvas.DrawString(10, 250, CUShort(BasicColor.White), Verdana14.ID, "Temperature Normal")
      End Select
      canvas.Execute() ' Updates RGB Display
    End Sub
  End Module
End Namespace

Thanks for the help, (especially Chris & Gutworks)
Chuck

#27 dieguich

dieguich

    New Member

  • Members
  • Pip
  • 4 posts

Posted 15 May 2012 - 08:54 AM

hello guys!! I've been trying to get on work a SDcard shield reader attached to the BaseShield and I've not still managed it : http://forums.netdui...in-netduino-go/ If you have any insight about how to get work this stuff please do not hesitate to send a reply to this post. Cheers!

#28 carb

carb

    Advanced Member

  • Members
  • PipPipPip
  • 352 posts
  • LocationCrystal River, Florida

Posted 15 May 2012 - 10:04 AM

hello guys!!

I've been trying to get on work a SDcard shield reader attached to the BaseShield and I've not still managed it : http://forums.netdui...in-netduino-go/

If you have any insight about how to get work this stuff please do not hesitate to send a reply to this post. Cheers!

Hi Diego,

I haven't had a chance to work with a SD card shield yet, I been waiting for the module to come out. But just playing with the shield base one thing that seems to get alot of people is setting the pullup / pulldown resistors.

Maybe you could could send the code that you have started and the make / model of the SD shield. Maybe someone can help get it up and running.

The code for the display module uses a sd card and may provide some insight.

Chuck B)

#29 Giuliano

Giuliano

    Advanced Member

  • Members
  • PipPipPip
  • 361 posts
  • LocationSimi Valley, CA

Posted 25 May 2012 - 12:47 AM

Hi Chuck,

I saw your really cool project in the picture you attached.

Where did you get the plastic board (I can't come up with other name for it, sorry) where you place the netduino and all the other boards? And where did you get the little clamps to hold the boards in place to the plastic board?

Thank you

Thats good to know, when do you think you will open the additional socket for the main board? With the shield base plugged in I have run out of sockets, DANG IT MAN, WE NEED MORE SOCKETS! (never mind if you were older you would understand). :blink:

I have run out and using the onboard push button.

Thanks,
Chuck



#30 carb

carb

    Advanced Member

  • Members
  • PipPipPip
  • 352 posts
  • LocationCrystal River, Florida

Posted 25 May 2012 - 01:35 AM

Giuliano,

Here is a current Ebay listing Tamiya Parts - Universal Plate Set III

I have two of them and the holes are 5mm center. A couple of the forum members (Nevyn & Pete Brown I think) wrote about the Tamiya Plates.

The standoff I purchased from Amazon (Small Parts Inc) Nylon 4-40 Standoffs I used 1/2". Also used 4-40 nylon nuts for the Male end and 4-40 nylon socket head cap screws x 1/4 long to attach to the board (the hole in the standoff is 3/16" deep + about 1/8" for the thickness of the plate).

Chuck

#31 Nevyn

Nevyn

    Advanced Member

  • Members
  • PipPipPip
  • 1072 posts
  • LocationNorth Yorkshire, UK

Posted 25 May 2012 - 03:24 AM

I have two of them and the holes are 5mm center. A couple of the forum members (Nevyn & Pete Brown I think) wrote about the Tamiya Plates.

Certainly did - I use metal hex spaces and the corresponding M3 screws as they are relatively cheap from my electronics supplier.

Regards,
Mark

To be or not to be = 0xFF

 

Blogging about Netduino, .NET, STM8S and STM32 and generally waffling on about life

Follow @nevynuk on Twitter


#32 Giuliano

Giuliano

    Advanced Member

  • Members
  • PipPipPip
  • 361 posts
  • LocationSimi Valley, CA

Posted 25 May 2012 - 04:29 AM

Thanks Chuck and Mark for the great info. I will be getting them soon.

Giuliano

Giuliano,

Here is a current Ebay listing Tamiya Parts - Universal Plate Set III

I have two of them and the holes are 5mm center. A couple of the forum members (Nevyn & Pete Brown I think) wrote about the Tamiya Plates.

The standoff I purchased from Amazon (Small Parts Inc) Nylon 4-40 Standoffs I used 1/2". Also used 4-40 nylon nuts for the Male end and 4-40 nylon socket head cap screws x 1/4 long to attach to the board (the hole in the standoff is 3/16" deep + about 1/8" for the thickness of the plate).

Chuck






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

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.