3

I'm interested in writing an app that send messages over IP (using 3g, not neccesarily on the same WiFi network as the receiving end) to a PIC microcontroller connected to a router (via ethernet or wifi)

I saw some descriptions and examples on how to send messages on the same network, not sure if just by giving a different IP it would work outside the network it self. I was wondering how can it be received by the PIC (still hasn't decided which PIC, depends on the possibility to perform this) and in turn, depends on the msg received, the PIC will perform an action, for example, light a certain LED in a LED array.

I have the sending side (the app sending over IP), and receiveing side (the PIC which lights the LEDs) I'm just not quite sure what to send, or if such "translation" is even possible.

I've searched the web but couldn't find any such thing except for made kit (for RC cars for example) Thanks. Carmel

La bla bla
  • 8,558
  • 13
  • 60
  • 109
  • What's running in the PIC? I have working code that sends and receives UDP packets cross-platform to/from an iPhone to anything on the network - would that help? – shein Apr 22 '12 at 06:49
  • Yeah, that sounds like exactly what i'm after. I though using Adruino, which is able to receive UDP packets over ethernet of wifi – La bla bla Apr 22 '12 at 07:09
  • Posted the link in the answers. Let me know if you need anything more specific – shein Apr 22 '12 at 14:20

3 Answers3

1

Well, if the PIC can run a TCPserver, or maybe just UDP, then sure you can control a LED by sending an appropriate message. With an appropriate static IP address and routing, then you can use your iPhone to turn on the LED from anywhere you can get a connection.

PICs are not exactly renowned for having high performance and lots of RAM. If you do manage to get a server working, try to not use XML/SOAP

Martin James
  • 24,453
  • 3
  • 36
  • 60
1

This looks more like a question for http://electronics.stackexchange.com.

If your familiar with SPI you could consider Microchip's MRF24WB0MA/RM module which enables PIC to connect to a wireless network (either to an infrastructure wireless or to AdHoc, or it can create its own AdHoc).

If you're using MCC compiler then you also have library available for this module at Microchip Application Libraries.

TCP stack takes some memory space though. PIC18F would do but you'd be better of with PIC24F (they tend to be cheaper than 18F anyway).

Rok Jarc
  • 18,765
  • 9
  • 69
  • 124
1

Here's a UDP library I built for Mac/iOS wrapped in simple Cocoa that sends UDP packets to an IP address of your choice. Comes with sample server client app.

This is generic UDP packets so you just have to listen for them on the other end ( whatever that platform is ) and read the content. Let me know if you need help with that

https://github.com/Shein/Mac-UDP-Client-Server

shein
  • 1,834
  • 15
  • 23
  • I'm thinking of using adruino. which can receive UDP packets. I thought maybe using OCS for sending instructions and such. I'm not exactly sure how to use UDP and such, can it be sent to a specific address when iphone is not in the same wifi network (i.e, outside of ur home)? – La bla bla Apr 22 '12 at 22:44
  • UDP is a client-server communication protocol. So typically you'd have one end acting as the server with a static IP address that is accessible from the web, and the clients connect to it from wherever in the world and send/receive packets. So - the iPhone does NOT need to be in the same network, building or country. BUT - you're arduino will need to be accessible from the web and have a static IP which you should be able to configure through your router – shein Apr 23 '12 at 02:51