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.

baxter's Content

There have been 63 items by baxter (Search limited from 24-May 23)


By content type

See this member's


Sort by                Order  

#61779 12 water flow sensors 160ft away from N+2

Posted by baxter on 05 March 2015 - 07:32 AM in Netduino Plus 2 (and Netduino Plus 1)

The ESP8266 WiFi modules might be a nice fit for your project.  When using the nodeMCU Lua firmware they basically become programmable wireless access points. The ESP-01 costs about $3 and exposes 2 GPIOs. The modules operate as a TCP client or server or both. Out of the box firmware uses an AT command set, but the Lua firmware offers much more and is very stable. They require about 240 ma when talking on the network and 70 ma when not. They are also 3.3V and not 5V tolerant. The disadvantage is that one needs to learn a bit of Lua, but there are plenty of examples in the nodeMCU forum link below.

 

GPIO2 supports an interrupt to count pulses for your sensor and the latest version of Lua has floating point math so you could directly compute the flow rate on each ESP module. Each ESP module also has its own MAC address and a chipID for identification, accessable via Lua functions. There is also a Lua repeatable timer alarm  with a callback function. This is where you could do your calculations and send the flow rate with an ID every X seconds via TCP or UDP.

 

The range in open air has been reported as 366 meters with the PCB antenna. This, however, is optimistic in the real world. I have an ASUS RT-n66U router and about 40 feet away from it, through 2 walls and a floor, a laptop shows 5 bars for the network SSID. For an ESP under the same conditions, the ESP broadcast SSID shows 2 bars signal strength. Given your longer distances, you might need to add a wireless extender to the mix.

 

If you use them behind a wireless router, each of the modules can obtain an IPaddress with with Lua code like the following: (Lua has a file system and a file is executed with dofile("myfile.lua")


-- File name: init.lua
print("set up wifi mode") 
--this is sent back to serial terminal if connected, otherwise does nothing
wifi.setmode(wifi.STATIONAP)
wifi.sta.config("ret13x","XXXXXXXXX")
 --here SSID and PassWord should be modified according your wireless router
wifi.sta.connect()
tmr.alarm(1, 1000, 1, function() -- repeat function every 1000 ms
    if wifi.sta.getip()== nil then 
    	print("IP unavaiable, Waiting...") 
    else 
    	tmr.stop(1)
    	print("Config done, IP is "..wifi.sta.getip())
    	--dofile("yourfile.lua")
    end -- if
 end) -- function

The init code will run on a powercycle or soft restart. The dofile("yourfile.lua") above will run once an IPaddress has been obtained and this is where you could put your flowmeter stuff.

 

here are some links,

 

ebay seller (USA fast shipping)

http://www.ebay.com/...html?rmvSB=true

 

nodeMCU forum:
http://www.esp8266.c...wforum.php?f=17

 

nodeMCU firmware(see pre_build) :
https://github.com/n...odemcu-firmware

 

API instruction set:

https://github.com/n.../nodemcu_api_en

 

For development, I use LuaLoader and a PC console TCP client for testing networking:
http://benlo.com/esp....html#LuaLoader




#58962 ATTiny85 talking to Netduino?

Posted by baxter on 30 June 2014 - 06:27 PM in General Discussion

https://learn.adafru...oducing-trinket

http://www.adafruit....or-the-trinket/

https://learn.adafru...usb-serial/code




#58971 Bitconverter class causing crash/irresponsiveness.

Posted by baxter on 02 July 2014 - 12:48 AM in Netduino Plus 2 (and Netduino Plus 1)

You can also use,

byte B = 0xac;
String S = B.ToString("X2");
Debug.Print(S); //--> AC



#59155 Can anyone recommend a rock-solid LCD display?

Posted by baxter on 10 July 2014 - 11:38 PM in Netduino Plus 2 (and Netduino Plus 1)

I have been using the BPI-216N/L Serial Text LCD for years. The COM port interface is about as simple as you can get.
http://www.seetron.com/products.html
It's a bit pricey and you can get something better with a serial interface for about the same price (look under Intelligent Display modules),
http://www.4dsystems.com.au/products
http://www.4dsystems...brief_R_1_1.pdf

 

I have the older version of this module and it is a very readable display.




#59340 change ip address netduino

Posted by baxter on 22 July 2014 - 06:57 AM in General Discussion

Open MFDeploy --> Menu:Target --> Configuration --> Network --> Network Configuration --> fill in the blanks 

Attached Thumbnails

  • Network Configuration.JPG



#59332 change ip address netduino

Posted by baxter on 21 July 2014 - 05:48 PM in General Discussion

Look under:

C:\Program Files(x86)\Microsoft .NET Micro Framework\v4.2\Tools\MFDeploy.exe




#58925 convert data types to byte[] and back for streaming

Posted by baxter on 27 June 2014 - 05:47 AM in General Discussion

I previously confronted this issue and found a couple of references,
https://www.ghielect...3/serialization
http://bytes.com/top...ture-byte-array

I copied the structure serialize code (near the bottom of the page) from the second reference and it compiles
just fine on the Mini using firmware 4.2.0.1.

Imports Microsoft.SPOT
Imports Microsoft.SPOT.Hardware
Imports SecretLabs.NETMF.Hardware
Imports SecretLabs.NETMF.Hardware.NetduinoMini
Imports System.Reflection
Imports System.Runtime.InteropServices
Imports Microsoft.VisualBasic.Constants
Imports System.Text
Imports System.Threading
Imports System.Collections

Module Module1
    Sub Main()
        Dim s As Struct = New Struct
        Dim ms As MyStruct = New MyStruct With {.el1 = 1, .el2 = 2, .el3 = 3}
        Dim sb() As Byte = Struct.Convert(ms)
    End Sub

    <StructLayout(LayoutKind.Sequential, Pack:=1, Size:=12)>
    Private Structure MyStruct
        Dim el1 As Byte
        Dim el2 As Int16
        Dim el3 As Byte
    End Structure

    Public Class Struct
    'Charles Law 
    'http://bytes.com/topic/visual-basic-net/answers/357098-convert-structure-byte-array

        Public Shared Function Convert(ByVal MyStruct As Object) As Byte()
            Dim al As ArrayList
            Dim Fields As FieldInfo() = MyStruct.GetType.GetFields
            al = New ArrayList

            For Each fld As FieldInfo In Fields
                If fld.FieldType.Equals(GetType(Byte)) Then
                    ' Add byte to array list
                    al.Add(CByte(fld.GetValue(MyStruct)))

                ElseIf fld.FieldType.Equals(GetType(Int16)) Then
                    ' Add 16-bit value to array list
                    Dim i16 As Int16

                    i16 = CType(fld.GetValue(MyStruct), Int16)
                    al.Add(CByte(i16 >> 8))
                    al.Add(CByte(i16 And &HFF))
                Else
                    Throw New Exception("Cannot convert type.")
                End If
            Next fld

            Return DirectCast(al.ToArray(GetType(Byte)), Byte())

        End Function
    End Class

    Public Function PrintArray(title As String, ByVal Arr() As Byte) As String
        Dim s As String = title & vbCrLf
        For i = 0 To Arr.Length - 1
            s &= "i = " & i.ToString & "  " & "Byte = " & Arr(i).ToString("X2") & vbCrLf
        Next
        Return s.Trim
    End Function


End Module

I didn't run it for this post because my Mini is in storage. I lost interest in this because I found for my purposes it was easier to just convert the data type to a string and then convert the string to bytes and then reverse this to go back to the data type (not too efficient, but it works)




#58819 De-Icing, Chickens, and Artificial Sunrise

Posted by baxter on 21 June 2014 - 04:58 AM in General Discussion

Here is a nice automatic chicken door project from the UK,

http://www.picaxefor...ic-Chicken-Door




#60509 Function for a curve?

Posted by baxter on 22 October 2014 - 07:15 PM in General Discussion

Here is a nice sequential mean and variance estimator,
http://www.johndcook..._deviation.html

Just sample the analog input or distance for X ms and you have the mean value together with the error estimate.




#60498 Function for a curve?

Posted by baxter on 22 October 2014 - 01:36 AM in General Discussion

I have a Sharp GP2Y0A02YK0F 20-150 cm Distance Sensor. I get good results with the attached function relative to a known distance. I am sorry I don't have the attribution for the curve fit. I think it comes from the Arduino forum. If you search for "Sharp ir distance sensor curve fit", other fits will turn up others with varying degrees of approximation. The functional relationship accurately describes the curve. Your sensor may yield different constants. Just pick some points off of the curve and do a curve fit for the constants  in Excel. You might also want to do some smoothing on the measurements because they are noisy with this sensor.

'enable Sharp Analog GP2Y0A02YK0F 20-150 cm Distance Sensor
Friend SharpSensor As AnalogInput = New AnalogInput(Cpu.AnalogChannel.ANALOG_0) 'Netduino Plus 1 analog pin 0

SensorVal = distance(SharpSensor.Read() * 3.3) 'in inches

Public Function distance(Volts As Double) As Double
        Dim result As Double
        Dim A As Double = 0.008271
        Dim B As Double = 939.6
        Dim C As Double = -3.398
        Dim D As Double = 17.339
        Dim one As Double = 1.0
        result = (A + B * Volts) / (one + C * Volts + D * Volts * Volts)
        Return result / 2.54 'inches
    End Function




#60021 Getting started with Netduino Mini (early instructions)

Posted by baxter on 07 September 2014 - 06:21 PM in Netduino Mini

I would try to update your firmware. Select the TTL zip file since you haxe a TTL cable.
http://forums.netdui...-v420-update-1/




#60035 Getting started with Netduino Mini (early instructions)

Posted by baxter on 08 September 2014 - 01:50 AM in Netduino Mini

Did you first try to erase it by applying 5V to the gold ERASE pad? It's located at the top on the right hand side.
Flashing instructions after erasing are here toward the bottom of the page,
http://forums.netdui...-v420-update-1/




#59637 High Resolution Quad Encoder Problem

Posted by baxter on 09 August 2014 - 06:19 PM in General Discussion

I bought a couple of CY8CKIT-049-42xx for $4.00 ea,

http://www.cypress.com/?rID=92146

http://www.digikey.c...-42xx&x=14&y=16

I don't know if I will do any thing with PSoC, but the break-away USB-Serial Controllers will prove useful.




#59283 How do I connect Netduino+ to a pc wireless?

Posted by baxter on 17 July 2014 - 05:34 PM in Netduino Plus 2 (and Netduino Plus 1)

I really think the key to getting these pocket routers to work is to assign fixed, but different IP addresses (outside of the main router DHCP range) and disable DHCP on both. The other important ingredient is to let the Edimax establish itself on the network before connecting the Netduino. Ping it and make certain it is in the ARP table. I also find that it works equally well with a network configured Plus 1 or Plus 2.




#58954 How do I connect Netduino+ to a pc wireless?

Posted by baxter on 30 June 2014 - 05:44 AM in Netduino Plus 2 (and Netduino Plus 1)

rickggaribay, sorry for the problems. Networking can be frustrating at times. I googled for the Vonets and it seems that there are problems in setting it up. The fact that it needs software for setup and is using WinPCap means that this is totally different from the Edimax approach which requires no installation software.

 

I just hooked up an Edimax that is established on my network with an IP address of 192.168.0.4 to a Netduino Plus 2 that is not running any network related code. I then went to MFdeploy and set the Plus 2 network parameters:
Static IP address: 192.168.0.50
Subnet Mask: 255.255.255.0
Default Gateway: 192.168.0.1
MAC Address: 5c-86-4a-00-50-0f
DNS Primary Address: 8.8.8.8
DNS Primary Address: 8.8.4.4
DHCP: unchecked

The router has a DHCP range of 100-200. I then opened a command prompt and pinged 192.168.0.50 followed by arp -a with the result:

Pinging 192.168.0.50 with 32 bytes of data:
Reply from 192.168.0.50: bytes=32 time=45ms TTL=255
Reply from 192.168.0.50: bytes=32 time=2ms TTL=255
Reply from 192.168.0.50: bytes=32 time=2ms TTL=255
Reply from 192.168.0.50: bytes=32 time=2ms TTL=255

Ping statistics for 192.168.0.50:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss)
Approximate round trip times in milli-seconds:
    Minimum = 2ms, Maximum = 45ms, Average = 12ms

C:\Users\beb\Desktop>arp -a

Interface: 192.168.0.175 --- 0xb <--- desktop PC hardwired ethernet
  Internet Address      Physical Address      Type
  192.168.0.1           98-fc-11-6e-6a-40     dynamic
  192.168.0.4           80-1f-02-19-25-98     dynamic <--- Edimax
  192.168.0.50          80-1f-02-19-25-98     dynamic <--- Netduino Plus 2
  192.168.0.104         98-4b-e1-55-78-d6     dynamic
  192.168.0.113         80-1f-02-9d-b4-ec     dynamic
  192.168.0.117         f4-ce-46-4d-22-bc     dynamic

Notice the physical (MAC) address of the Netduino; it has now taken the MAC of the Edimax. I have no idea how this happens. But I think that the effect is that when you address the Netduino by its IP, it is actually being resolved to the Edimax which passes the traffic through to the Netduino. Although not certain, I believe that all of these ethernet to wireless adapters work the same way. I would suggest that you re-setup your Netduino network parameters with MFdeploy and make certain you are on the same subnet of your network. When I was searching for Vonets, I did notice that the latest software was important to get the adapter working.




#58711 How to 3D print your project a custom case!

Posted by baxter on 13 June 2014 - 11:36 PM in General Discussion

Yes, there is a reason. When the light shines just right you can see the surface roughness. The Da Vinci business model has also received a lot of criticism for the chipped, proprietary filament cartridge. I wish I could afford a Form1 printer. The Da Vinci is cheap enough to play with, but I think I would be disappointed with its results. Thanks for the information about your service.

 

 




#58704 How to 3D print your project a custom case!

Posted by baxter on 13 June 2014 - 04:58 PM in General Discussion

As someone obviously familiar with 3D printing, what do you think of the Da Vinci 1.0 3D Printer?

http://www.amazon.co...bs_6066127011_1




#59359 How to control netduino plus 2 over the Internet

Posted by baxter on 23 July 2014 - 09:19 PM in Netduino Plus 2 (and Netduino Plus 1)

What about DynDNS,
http://dyn.com/support/wizard/

http://www.tp-link.u...icle/?faqid=297
I haven't used it for a while, but I set it up for a Netduino Plus 1. It's fiddly to get going from behind your router unless you have a smartphone (or use a neighbor's network). Most consumer routers do not have NAT loopback so testing needs to be done from a network external to your local network. Or, in my case, I used a spare router running DD-WRT with NAT loopback for local testing. DynDNS is no longer free, but there are other services.

 

I don't see that this poses a greater security risk than other traffic coming in through your ISP.




#60391 I2C issue with multiple sensors

Posted by baxter on 11 October 2014 - 08:34 PM in Netduino Plus 2 (and Netduino Plus 1)

Have you looked at this for multiple devices on the I2C bus?
http://forums.netdui...e-i2cbus-class/




#59416 IE support with this forum software - copy and paste doesn't work

Posted by baxter on 27 July 2014 - 04:28 PM in Netduino Plus 2 (and Netduino Plus 1)

This has been frustrating for me also. Maybe it is both an IE11 and a Forum problem. If I login with Chrome, pasting this this message from Notepad into a  Reply box works just fine.




#59081 InterruptPort/Events slow the first time

Posted by baxter on 07 July 2014 - 05:26 PM in General Discussion

Not VS 2013, but Using C# 2010 Express, MF4.2 and pushing the button on a Plus 2, yields nearly instantaneous debug output and led blink.

--> Button interrupt caught.




#60115 Netduino 2 and Dfrobot GSM/GPS Shield

Posted by baxter on 14 September 2014 - 06:25 PM in Netduino 2 (and Netduino 1)

I just bought a discounted Seeed Gprs at Radio Sack,
http://www.seeedstud...erface_Function
I now find that Seeed is selling a new model, but the basic functionality is the same as the old one.

 

The serial setup is different from yours, but I think they are doing the same thing. I have mine with the jumpers set to hardware. The shield is plugged in to the Netduino and Netduino is directly talking to the module via COM1. If you want to talk to the module from a PC terminal, configure yours for hardware, but don't plug it in to the Netduino.and take power externally. Then connect a USB-TTL cable to D0, D1 on the shield. The USB to RS232 cable you linked is wrong for this application.  You might look at these depending upon the versatility you want ( you can get a cheaper USB to TTL  adapter on ebay),

 

https://www.sparkfun.../products/12977

https://www.sparkfun.../products/11736

 

My driver in VB seems to working ok with simple commands,

        SeeedGprs.SendReceiveCmd("AT") 'can communicate
        Debug.Print("CmdSent: " & SeeedGprs.CmdSent)
        Debug.Print("CmdAnswer: " & SeeedGprs.CmdResponse)
        Thread.Sleep(400)
        SeeedGprs.SendReceiveCmd("AT+COPS?", , 400) 'Carrier info
        Debug.Print("CmdSent: " & SeeedGprs.CmdSent)
        Debug.Print("CmdAnswer: " & SeeedGprs.CmdResponse)
        Thread.Sleep(400)
        SeeedGprs.SendReceiveCmd("AT(+CSQ)") 'signal quality
        Debug.Print("CmdSent: " & SeeedGprs.CmdSent)
        Debug.Print("CmdAnswer: " & SeeedGprs.CmdResponse)


CmdSent: AT
CmdAnswer:  OK 
CmdSent: AT+COPS?
CmdAnswer: PS: 0,0,"T-Mobile"  OK 
CmdSent: AT(+CSQ)
CmdAnswer: OR 
 

To go much further, I need an activated SIM card. The phones I have use a micro SIM and these modules take a standard size. I guess the answer is to just use the carrier for a micro SIM in in an activation kit.

 




#59735 Netduino Mini $10

Posted by baxter on 16 August 2014 - 02:02 AM in Netduino Mini

Thanks ... Great price, bought one.




#58926 NetDuino Plus 2 + Spark.io ?

Posted by baxter on 27 June 2014 - 06:53 AM in Netduino Plus 2 (and Netduino Plus 1)

I bought a Spark Core and it looks to be a nice companion to provide WiFi capability for a Mini or a Netduino 1 or 2 by talking over the serial port as EnergySmithe noted. There are two serial ports, serial and serial1. The former is the regular Arduino debug port to be used with a serial terminal and the latter would be used to talk to a Netduino. The IDE is cloud based with the same buttons as the Arduino IDE, verify, flash ... They also have an Android App to work with the pins and configure the core for your network. I found the following sample code for a webserver and it works like a charm. The only problem I see with it vs Netduino is shifting gears to program an Arduino.

TCPClient webClient;
TCPServer webServer = TCPServer(80);
char myIpAddress[24];
int LED = D7;

void setup() {
    pinMode(D7,OUTPUT);         // Turn on the D7 led so we know it's time
    digitalWrite(D7,HIGH);      // to open the Serial Terminal.
    
    Serial.begin(9600);

  // Now it's ok to open your serial terminal software, and connect to the
  // available COM port.  The following line effectively pauses your
  // application waiting for a character to be received from the serial
  // terminal.  While it's waiting it processes the background tasks to
  // keep your Core connected to the Cloud.  Press ENTER in your 
  // serial terminal to start your application.
  while(!Serial.available()) SPARK_WLAN_Loop();
  
    Spark.variable("ipAddress", myIpAddress, STRING);
    IPAddress myIp = Network.localIP();
    sprintf(myIpAddress, "%d.%d.%d.%d", myIp[0], myIp[1], myIp[2], myIp[3]);
    
    Serial.print("Spark Core connected to IP: ");
    Serial.println(myIp);
    digitalWrite(D7,LOW); // Turn off the D7 led ... your serial is serializing!
    
    webServer.begin();
}

void loop() {
    if (webClient.connected() && webClient.available()) {
        serveWebpage();
    }
    else {
        webClient = webServer.available();
    }
}

void serveWebpage() {
    //TODO: read in the request to see what page they want:
    //TODO: retrieve larger content from flash?

    webClient.println("<html>Hello I'm serving a webpage!</html>\n\n");
    webClient.flush();
    webClient.stop();
    delay(100);
}




#58657 NetDuino Plus 2 + Spark.io ?

Posted by baxter on 10 June 2014 - 03:50 AM in Netduino Plus 2 (and Netduino Plus 1)

I don't think the Spark Core is Micro Framework compatible. You may have a bit of trouble connecting the hardware to a Netduino Plus 2. Maybe you could talk to it over the serial interface. Or perhaps, give your Netduino a wireless interface with an ethernet to wireless adapter ,

http://forums.netdui...-a-pc-wireless/





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.